lua-users home
lua-l archive

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


Hi Thomas,

I'm investigating it. I will keep you informed ...

-- waldemar

At 19:21 19/6/2002 -0700, you wrote:
I've made some progress on the problem. The leak goes away if i comment out
the following line in the tolua binding file.

toluaI_reg_types(tolua_S);

My simple script will continue to work, but the more complex ones in the
full system won't.  Is this a bug with cleaning up the user defined
types/classes in tolua?

Thomas
________________________________________________________________________
________________________________________________________________________

Message: 5
   Date: Tue, 18 Jun 2002 18:43:21 -0700
   From: "Thomas Tong" <toes@telus.net>
Subject: ToLua - 24 byte mem leak.. suggestions?

Hi,

I'm getting a 24 byte memory leak in my application everytime i call a C++
function that returns a user defined class in LUA. This bug has been
plauging our application for months, and these 24 byte sized leaks are
getting out of hand. :) I havn't been able to figure it out. Any help would
be greatly appreciated.

A very simple test case application in Visual C++ 6.0 is here showing it
occuring using a basic class. The following is a link to it, you may need to
cut and paste it into your browser.

http://www.brainchildstudios.com/download/LUA_TEST_24Byte_Leak.zip

I have a C++ singleton class that returns a pointer to itself. The following
is the defination i have in the test case.

//tolua_begin
class exportTest
{
    public:
        static exportTest* p();
        void DoStuff();
};
//tolua_end


In lua i called the function in the following way.

pointer = exportTest:p();
pointer:DoStuff();

The code works fine execept i get a 24 byte leak every time when calling
"exportTest:p()" even if i don't keep a copy of the pointer.  This only
happens once no matter how many times i call that function. The problem is I
get a the leak for once for every unique class binding.  Any sugestions of
how i can track down this problem would be fantastic.

Thomas



________________________________________________________________________
________________________________________________________________________



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/