🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Memory leak about boost.python

Started by
11 comments, last by iceryeah 20 years, 2 months ago
i write these codes: m_MainModule.reset( new extract<object>(PyImport_AddModule("__main__"))() ); m_MainModule is a boost share_ptr object so i found it casuses memory leak. is any method to solute the problem? thankss
game design
Advertisement
From the tutorial: handle<> main_module(borrowed( PyImport_AddModule("__main__") ));

[edited by - Fruny on April 27, 2004 9:54:30 AM]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
i have search many website,but i dont find any boost.python script engine .
do u know any open source script engine?

game design
i write these codes just now:
class xx
{
protected:
handle<> m_Module;
}

then it causes leak already.
game design
How are you detecting your memory leaks ?
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
using mfc method, overload new opreator,
and also using boundchecker.
game design
my codes:
void Initialize( void )
{
if (!Py_IsInitialized())
{
Py_Initialize();
}

handle<> main_module(borrowed( PyImport_AddModule("__main__") ));
}

only these codes, and i dont excute this function, it also causes leak!
i cant understand. faint....
game design
If you don''t call the function, then your problem obviously lies elsewhere.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
but if i delete this line, there is no leak.
game design
As much as i''d like to bash Python i have to say, that Boundschecker sometimes doesn''t recognize globals/non-pointer-members as being automatically removed/deleted. Boundschecker is a fantastic tools for finding leaks (and more) but sometimes it doesn''t show things right.

Try to add that handler as a pointer, new it on begin and delete in on the end. If the memory leak is still there then it''s real.

If the leak points to inside the boost.python.something then you could look into the boost.python FAQ or email the boost.python guys.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement