[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Tolua/lua memory leaks
- From: Jardar Johannes Maatje <maatje@...>
- Date: Tue, 17 Jun 2003 00:28:04 +0200 (CEST)
I'm new to this list so it is very likely that this has been handled
before, but I ask my question anyway.
We have are having quiet a lot of
memoryleaks from the lua scripting system. We are using toLua to generate
to the code. There are two types of memory leaks. One leak
appears when returning params by value
instead of reference. As far as I understood toLua where supposed to take
care of this?
Btw we are using lua 4 and not 5.
A typical example where a memoryleak will appear is below (a pkg file used
for toLua):
class GamePos2d{
public:
GamePos2d(float x, float y);
~GamePos2d();
GamePos2d normalized();
}
When calling normalized method a leak will appear and can be tracked down
to the duplication of the GamePos2d object. It seems that the automatic
deletion of the duplicate object does not work.
We have also another leak that are comes from toLua/lua scripting. I have
not been able to locate them, but thet are typically of 20-40 bytes in
size.
These
does not seem to come from the same problem though, i.e. will also be
there without returning by value. I'm not sure i the above example is
representative for this kind of error though.
Jardar