lua-users home
lua-l archive

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


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.

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

class exportTest
        static exportTest* p();
        void DoStuff();

In lua i called the function in the following way.

pointer = exportTest:p();

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.