Memory leak still present in 0.4.2 (python 3.6)

Issue #2 closed
K.C. Budd
created an issue

memtest.py:

#!/usr/bin/env python

from recordclass import recordclass
import random
import time

X = recordclass('x', ['a','b','c'])

while True:
  a = X(str(random.randint(1000000,10000000)), random.randint(1,1000),
            'a' * random.randint(1,1024))
  del a
  time.sleep(.01)

ps -aux fields 5 & 6 show memory usage of the process:

$ while [ true ]; do ps aux | grep memtest | grep -v grep; sleep 1; done
ccarb     2643  1.0  0.5  43292 11048 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  1.0  0.5  43292 11048 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.8  0.5  43292 11308 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.7  0.5  43680 11308 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.6  0.5  43680 11308 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.5  0.5  43680 11308 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.6  0.5  43812 11308 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.6  0.5  43812 11572 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.5  0.5  43812 11572 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.5  0.5  43944 11572 pts/9    S+   19:37   0:00 python ./memtest.py
ccarb     2643  0.5  0.5  43944 11572 pts/9    S+   19:37   0:00 python ./memtest.py

Running the same code with collections.namedtuple instead of recordclass doesn't exhibit the memory utilization climb.

$ python --version
Python 3.6.0
$ pip show recordclass
Name: recordclass
Version: 0.4.2
Summary: Mutable variant of collections.namedtuple, which supports assignments
Home-page: http://intellimath.bitbucket.org/recordclass
Author: Zaur Shibzukhov
Author-email: szport@gmail.com
License: MIT License
Location: /home/ccarb/.pyenv/versions/3.6.0/envs/general/lib/python3.6/site-packages
Requires:

Comments (4)

  1. zaur shibzukhov repo owner

    Seems now there is no memory leak for python 3.6.

    However for python <3.6 heap memory remain growing. I don't care is this memory leak or just symptom of heap fragmentation...

  2. Log in to comment