lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> > I don't want to seems stubborn, but some days ago I asked a question
> > went unnoticed, so I ask again :-)
> I did answer you!
> > > The stand-alone Lua executable has the -c option, to "call lua_close
> > > after running all arguments". For me, I have to put this option
> > > systematically. So why is this an option? In which cases it can be
> > > unnecessary, or even troublesome, to use it?
> > 
> > In several "common" platforms (such as most Unixes and Windows) you
> > get nothing by closing the state, as all resorces (memory and file
> > descriptors) are automatically released by the system when the program
> > ends.
> > 
> > On the other hand, closing a large state takes some time, as Lua has to
> > release all memory it was using.
> > 
> > -- Roberto

Oops, sorry, I must have forgotten it or read it too fast :-(

Thank you for having the patience to quote yourself.

Note that I don't think Windows releases automatically allocated memory, as
somebody reported memory leaks because he didn't knew the -c switch.
Windows closes file descriptors, but we still have to clean the memory after
ourselves. That's why Windows systems become instable after some time when
running bad applications: as they leak memory, the available resources are
slowly eaten.
That's why we have BoundsChecker, Purify, etc. :-)

Can I make a suggestion to put your quote in the new manual? Thank you.


Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist

GMX - Die Kommunikationsplattform im Internet.