brentp / hts-python

pythonic wrapper for libhts (moved to: https://github.com/quinlan-lab/hts-python)
https://github.com/quinlan-lab/hts-python
MIT License
49 stars 18 forks source link

Memory leak in string construction #8

Open pjb7687 opened 8 years ago

pjb7687 commented 8 years ago

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

brentp commented 8 years ago

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