Open damithc opened 9 years ago
Confirmed using other comp.
In #940, I noticed that a repo model will live throughout a session, even if it is unused. I created a function to delete a model when user remove a repo. The problem is that there is no way to ensure that memory is released once the model is deleted.
What's the fix for this? From @ndt93's work in #673 it doesn't seem like it's the model objects that dominate memory usage.
@dariusf I was looking more on the description where project data is never released. I am not sure how the memory profile will be, though.
I'm just concerned we can't resolve this by this milestone. :grin: We also don't really have a way to free memory, unless it's a memory leak that's being fixed.
Agreed haha. But I will just delete the models first. We'll see then.
After the model is deleted, it should eventually (if not immediately) be released by the runtime?
Looking at my memory monitor (not using YourKit yet), the memory actually goes up. I will leave it running for a while and see if it goes down.
I think the problem is as mentioned in #673. Model's member variables are mostly final, and it seems that they will not be released even if the model who owns them is deleted.
I tried opening a repo, deleting its model, then reopening the repo. The memory actually increases as if I open a new repo of same size.
Update: leaving it running for about 4 hours make the memory increases from ~350MB to ~450MB.
I have moved deleting model of unused repo to new issue, #1028.
Just some notable observations on the work for the aforementioned issue.
Did this memory test:
The result is as expected: 3 Model-s are deleted, but this only freed about 120 bytes of data. Everything else is virtually the same. I don't think this fixes the issue.
http://stackoverflow.com/questions/4952568/is-there-a-way-to-lower-java-heap-when-not-in-use tl:dr; It seems that once a memory has been allocated to JVM, it won't be released back to the OS for a very long time, even if JVM does not need it. In memory profiling of HubTurbo, it does not use much of the memory allocated in a long run. It uses most of the allocated memory only on loading repo (both downloading and from JSON).
The memory usage corresponds to total projects loaded during a session. Looks like project data is loaded but never released.