Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataStruct vectors leak when iterating #4465

Closed
bp-kelley opened this issue Sep 1, 2021 · 0 comments · Fixed by #4466
Closed

DataStruct vectors leak when iterating #4465

bp-kelley opened this issue Sep 1, 2021 · 0 comments · Fixed by #4466
Labels

Comments

@bp-kelley
Copy link
Contributor

bp-kelley commented Sep 1, 2021

Describe the bug
The Vectors defined in DataStructs leak memory when using pythonic iterators.

This appears to be caused by a leak in the C++ IndexErrorException that isn't properly wrapped.
The solution appears to be a simple import of rdkit.rdBase which defines these properly

To Reproduce

from rdkit.DataStructs import SparseBitVect
# if you add the following there are no leaks
#from rdkit import rdBase
import random
s = SparseBitVect(2048)
bv = SparseBitVect(2048)
for i in range(100):
    s.SetBit(random.randint(0,2047))

while 1:
    l = list(s)

Expected behavior
No memory leaks

@bp-kelley bp-kelley added the bug label Sep 1, 2021
@greglandrum greglandrum added this to the 2021_03_6 milestone Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants