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

Avoid possible memory-leak with returned result #57

Closed
manodeep opened this issue Apr 16, 2016 · 1 comment
Closed

Avoid possible memory-leak with returned result #57

manodeep opened this issue Apr 16, 2016 · 1 comment

Comments

@manodeep
Copy link
Owner

All of the APIs return a heap-allocated struct result. This has potential for a memory-leak, in case the user does not free the memory afterwards. I am probably doing that from the python interfaces. An easy fix would be to replace those with stack-allocated structs, this would require replacing all results-> with results.

manodeep added a commit that referenced this issue Jul 31, 2016
… struct. The fields within the struct (npairs, rupp, rpavg etc) are still heap variables and do need to be freed. Partly fixes #57
@manodeep
Copy link
Owner Author

To completely avoid memory leaks would require the entire struct results to be on the stack => a compile-time max limit on nbins would have to be imposed. I could probably enforce something like MAX_NBINS = 2048; I can't imagine requiring more than 2048 bins. Closing for now - might revisit before v2.0.

manodeep added a commit that referenced this issue May 13, 2017
… struct. The fields within the struct (npairs, rupp, rpavg etc) are still heap variables and do need to be freed. Partly fixes #57
manodeep added a commit that referenced this issue May 13, 2017
… struct. The fields within the struct (npairs, rupp, rpavg etc) are still heap variables and do need to be freed. Partly fixes #57
manodeep added a commit that referenced this issue May 13, 2017
… struct. The fields within the struct (npairs, rupp, rpavg etc) are still heap variables and do need to be freed. Partly fixes #57
manodeep added a commit that referenced this issue May 13, 2017
… struct. The fields within the struct (npairs, rupp, rpavg etc) are still heap variables and do need to be freed. Partly fixes #57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant