hts-python icon indicating copy to clipboard operation
hts-python copied to clipboard

Memory leak in string construction

Open pjb7687 opened this issue 9 years ago • 1 comments

Hello,

I am inspired by your code and currently developing a cffi-based pysam alternative which works with Pypy. While testing your code I found that

ffi.new('kstring_t *', {'m': 0, 'l': 0, 's': ffi.NULL})

causes memory leak, so I replaced it with Pythonic way. You can find the change here:

https://github.com/pjb7687/hts-python/commit/cd35d6f15221bb09c218d0f978c0b92c560fcdd6

Maybe there would be better way to do this? Thank you so much for your contribution!

Best regards, Jeongbin Park

pjb7687 avatar Oct 19 '16 08:10 pjb7687

Thanks for reporting. I didn't know about the memory leak. I think the better solution is to just free kstr.s

brentp avatar Oct 19 '16 12:10 brentp