Memory leaks whilst embedding python

Brad Clements bkc at Murkworks.com
Sat Jul 24 11:20:08 EDT 1999


This, however, is going to be a giant problem for me.

I'm porting Python to Novell NetWare, and that platform complains quite a
bit when a process is unloaded without freeing up it's memory. Also, SWIG
produces wrappers that suck up a lot of memory in init.

Because Python doesn't finalize modules, I can't clean up this memory...

I'm going to have to write my own memory allocator and fake out Python and
all add-on modules to use it, what a major pain.


--
Brad Clements,
bkc at murkworks.com
Gordon McMillan <gmcm at hypernet.com> wrote in message
news:1279335510-28879097 at hypernet.com...
> Chris Williamson discovers that:
>
> >      Py_Initialize();
> >      Py_Finalize();
>
> leaks.
>
> Well, if MSVC reported on all of MFC's static allocations, you'd see
> that it leaks, too.
>
> These are nothing to worry about. It's static data that Python needs
> to run. It won't continually grow. If you use the debug memory stuff,
> you should take your checkpoint after Py_Initialize and report before
> Py_Finalize. In fact, you should probably take your checkpoint after
> you've done your imports, because a lot of the memory they use won't
> get released until Py_Finalize.
>
>
>
> - Gordon
>
>






More information about the Python-list mailing list