-
Notifications
You must be signed in to change notification settings - Fork 31
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
Memory leaks #78
Comments
Yes, agree that we have some memory leaks. How did you find them? Unexpected crashes or were you using some tool like valgrind? Could you list the ones that you are aware of? |
The hardware the library is running on has very limited ram (2 megabytes). It was running out of memory very quickly. For the detection of leaks i used the gcc address sanitizer. I have already some fixes but i wanted to discuss one more aspect. The memory used for an inference can be freed while the inference is running, to reduce the memory foot print. Only the results of prior node is needed to calculate the actual node. |
Could you provide the commands you used for the gcc address sanitizer? In the future some kind of memory leak detection should be included in the GitHub Action CI. Regarding freeing memory from past nodes, I agree that there are some optimisations that can be made, but note that its not that straight forward. A model like mnist is a set of nodes connected in series to each other, so freeing the memory from the previous node output will work just fine, but there are more complex models that contain "branches" and "Only the results of prior node is needed to calculate the actual node." won't be true. So we would need some kind of algorithm that scans the model an decides which outputs can be freed, and which ones will be needed later on in a different node. Having a flag with this choice (free unused outputs vs keep them) would be a really nice future, but imho it needs a bit of thinking. Feel free to open a new issue with this feature request :) |
You can compile the software with the additional gcc flag |
There are multiple memory leaks, which needs to be removed
The text was updated successfully, but these errors were encountered: