lua-users home
lua-l archive

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


>  Both do the job, but os.exit() will cause the process to end immediately
> without the garbage collector doing a final clean up.  I found this out the
> hard way when I had some code that would flush a file and close it when the
> object was garbage collected, but calling os.exit() would leave the file in
> an inconsistent state.  Doing a 'return' from the script would cause the GC
> to kick in.

I suppose you had some extra on "__gc"? I always believed the Linux
kernel will call a clean close() on all open file descriptors when
terminating a process.