StandardCyborg/StandardCyborgCocoa

Memory allocation increases with each new scan

Closed this issue · 8 comments

Hi! First thanks for this great project! :)
I'm running into memory issues when I do several scan sessions in succession.
When profiling my app I can see that memory allocation increases with each new scan but never goes down again.
Am I the only one with this problem or am I doing something wrong on my side?

Yes, I'm saving them to the app's document directory intentionally using our own method, including normals and color information.
Anything I have to consider here memory wise?

Memory consumption increases with each scan until the app finally crashes.
It looks to me as if memory isn’t freed at some point. This could only be in the C++ part though, right?
Instruments doesn’t show any leaks.

Thanks for your help!

Why would saving to the file system (App’s document directory) increase memory consumption?

How would I delete the scans to free memory?

Yes, this certainly sounds like a memory leak or abandonment, not an issue with file saving.

To help diagnose, would you mind sharing an Instruments trace with the Leaks and Allocations instruments?
Ideally I’d like to see a generation analysis, which can track down memory that’s abandoned and not just leaked. To do so, with Allocations selected, click Mark Generation, do a scan, close the scan, click Mark Generation, and repeat a couple more times. Here’s a nice tutorial on that if you’re not already familiar!
https://www.kodeco.com/16126261-instruments-tutorial-with-swift-getting-started#toc-anchor-008

OK so it turned out that we had a bug in our app lifecycle and the memory issue only appeared to be stemming from StandardCyborg 😅
Sorry for that. I'm going to close this issue.