-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
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:
Line 50 in e0f5088
PyErr_SetString(PyExc_ValueError, "The value of mode must be one of: " |
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)
Metadata
Metadata
Assignees
Labels
No labels