-
Type:
Bug
-
Resolution: Done
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: python-bsonjs
-
None
-
None
-
Python Drivers
-
Not Needed
-
-
None
-
None
-
None
-
None
-
None
-
None
User arnimarj opened ihttps://github.com/mongodb-labs/python-bsonjs/issues/62:
"Hi,
I believe I've found a memory leak in the handling of illegal mode arguments to dumps(). It looks like the reader object is not destructed when the mode argument is invalid: https://github.com/mongodb-labs/python-bsonjs/blob/e0f5088f03ef2526bb839659342309d234d4922f/bsonjs/bsonjs.c#L50
This script seems to reproduce it:
"
import itertools import resource import bsonjs b = b'\x15\x00\x00\x00\x10_id\x00\x01\x00\x00\x00\x10x\x00\x02\x00\x00\x00\x00' illegal_mode = 42 for i in itertools.count(): try: bsonjs.dumps(b, illlegal_mode) except ValueError: pass if i % 100_000 == 0: print('ru_maxrss', resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
We should fix the memory leak and make a release.