[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: toLua 5 errors/questions
- From: lukey@... (Jens Hassler)
- Date: 11 Sep 2003 21:41:00 +0200
> I'm also having some problems, which I think are different to your
> problems. Mine relate to function overloading and renaming.
Yeah. Although these problems are not hard to fix in the resulting cpp
file, it's annoying to correct them manually.
I've just encountered another problem.
I have this in my .pkg file:
------------------------------------------------------------------------
typedef struct statistics {
int value1;
int value2;
...
} statistics;
statistics get_statistics();
------------------------------------------------------------------------
ToLua creates a "collect_statistics" function to free the memory that is
assigned on a Lua call like:
local my_stats = get_statistics()
But it seems these objects are never garbage collected. I realized it
when I saw that the gccount was increasing rapidly when running some of
my scripts (sometimes this function is called more than a dozen times
per second).
I just made a test. The whole memory is freed when the script ends
(lua_close() is called). Shouldn't it be freed / garbage collected as
soon when the "my_stats" local runs out of scope or is overwritten with
a new table?
I think this also worked very well with Lua/toLua 4. At least my scripts
didn't consume several MB of memory after some minutes of runtime...
Any hints?
Bye,
Jens