#1186 builtin seems to leak memory

pending-fixed
szager
python (259)
5
2011-08-22
2011-08-02
No

swig version: trunk
python version: Python 2.7.1+
gcc: (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

I recently attempted creating a SWIG python wrapper using the following flags: "-python", "-builtin", "-fastdispatch", "-modern", "-c++"
The resulting object seems to be faster, but it also seems to leak memory.

when I run this code:
import Tuple
while True:
Tuple.Tuple()

and monitor the python interpreter in top, i see that memory is constantly being allocated for new objects, but never freed. i've also checked that this isn't a case of lazy GC, and i've run:
import gc
gc.collect()

and then re-run the above to find that memory isn't being freed.

when i create my wrapper without the -builtin flag, the python interpreter seems to be able to GC the SWIG objects just fine.

thanks for making the -builtin feature! it seems quite a great deal faster, i hope i can provide any needed information to allow this bug to be fixed.

Discussion

  • szager

    szager - 2011-08-22

    I've committed a fix to CVS.

     
  • szager

    szager - 2011-08-22

    Thanks for reporting this; you are correct about the memory leak.

    I have committed a fix as revision 12782; it will go in the next SWIG release.

    Stefan

     
  • szager

    szager - 2011-08-22
    • assigned_to: nobody --> szager
    • status: open --> pending-fixed
     
  • David Lichterman

    thank you so much!

     

Log in to post a comment.