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

Memory leak #399

Closed
jessegreenberg opened this issue Jan 31, 2018 · 11 comments
Closed

Memory leak #399

jessegreenberg opened this issue Jan 31, 2018 · 11 comments
Assignees

Comments

@jessegreenberg
Copy link
Contributor

From #398. I noticed the following profile after recording heap size every 30 seconds or so, 98.6MB is larger than I usually see so I am wondering if this sim has a memory leak.
capture

@jessegreenberg
Copy link
Contributor Author

I am not too familiar with chrome memory tools, but I think this comparison view indicates a leak of many Vector2s and Bounds2s? And maybe other things too.
mem view

@jessegreenberg
Copy link
Contributor Author

Using studio to visualize instances, I see this count at the top:
On load:
launch
After dragging 3 track segments into the play area:
3-segments
After pressing Reset All:
reset all

Reset All increasing instance count is the strangest.

@jessegreenberg
Copy link
Contributor Author

Every time I press ResetAllButton, instance count increases by ~115.

@jessegreenberg
Copy link
Contributor Author

When I press ResetAllButton, I see new instances of Tracks and ControlPoints in studio. Reset All eventually calls clearTracks, calling addDraggableTracks, creating new tracks for the toolbox. Ill probably start there.

@jessegreenberg
Copy link
Contributor Author

To find the leak in reset, I hacked EnergySkateParkBasicsModel.manualStep to call EnergySkateParkBasicsModel.reset. Pressing and holding the step button for 10 seconds with this causes the sim to grow to 200 MB.

@jessegreenberg
Copy link
Contributor Author

Lots of Objects like this in the chrome memory comparison indicate that detachableProperty is not being disposed.
capture

@jessegreenberg
Copy link
Contributor Author

Other than a RadioButtonGroup, it looks like TrackNode is the only place that adds listeners to detachableProperty, TrackNodes are never disposed.

@jessegreenberg
Copy link
Contributor Author

Removing the listener in TrackNode really helps, holding the step button (that is hacked to call reset) for 20 seconds, and the heap only grows a couple of MB.

jessegreenberg added a commit that referenced this issue May 30, 2018
@jessegreenberg
Copy link
Contributor Author

New memory profile fuzzing screen 3, snapshot taken every 30 seconds:
capture

@jessegreenberg
Copy link
Contributor Author

Fuzzing all screens for 30 seconds:
capture

@jessegreenberg
Copy link
Contributor Author

Memory profile over 10 seconds of fuzzing:
tempsnip

I think we are there!

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