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

Test for memory leaks as part of code review #327

Closed
jbphet opened this issue Jul 13, 2023 · 6 comments
Closed

Test for memory leaks as part of code review #327

jbphet opened this issue Jul 13, 2023 · 6 comments
Assignees

Comments

@jbphet
Copy link
Contributor

jbphet commented Jul 13, 2023

The code is being reviewed for this sim prior to releasing the phet-io version. This issue is where the results of the memory leak testing for both the phet and phet-io brands will be recorded.

@jbphet jbphet self-assigned this Jul 13, 2023
@jbphet jbphet mentioned this issue Jul 13, 2023
80 tasks
@jbphet
Copy link
Contributor Author

jbphet commented Jul 18, 2023

The dev version that I'll use for memory leak testing is https://phet-dev.colorado.edu/html/greenhouse-effect/1.2.0-dev.1/phet/greenhouse-effect_all_phet.html.

@jbphet
Copy link
Contributor Author

jbphet commented Jul 18, 2023

The memory leak test looks good, see the screenshot below. I followed the standard procedure, so snapshot 1 is after loading the sim normally (no fuzz, no interaction). Snapshot 2 was taken after 1 minute of fuzz testing, snapshot 3 after 2 minutes, and so forth through snapshot 11. Snapshot 12 was taken 10 minutes after snapshot 11, and 13 was 10 minutes after that. The memory usage appears to stabilize at a value around 83MB, which is reasonable. I think we're good here. Closing.

image

@jbphet jbphet closed this as completed Jul 18, 2023
@jbphet
Copy link
Contributor Author

jbphet commented Jul 18, 2023

Reopening. I was just going through the code review checklist and realized this test needs to be done in Studio as well to verify that the sim isn't leaking phet-io objects.

@jbphet jbphet reopened this Jul 18, 2023
@jbphet
Copy link
Contributor Author

jbphet commented Jul 19, 2023

Phet-io memory testing using colorized data stream.

Local link: http://localhost:8080/greenhouse-effect/greenhouse-effect_en.html?brand=phet-io&phetioConsoleLog=colorized&phetioStandalone&phetioEmitHighFrequencyEvents=false&locales=*&keyboardLocaleSwitcher&ea&debugger&fuzz

This test was a bit problematic because the developer tools kept closing by themselves every 4 minutes or so, probably because they were getting overwhelmed by the amount of data being output to the console. The heap snapshot history was lost each time this happened. So, I ran the test and wrote down the memory numbers, and put it in the table below. It looks like there is no leak, and the memory usage tops out at 120 MB, which is definitely higher than the non-phet-io case, but still, I believe, acceptable.

Time (minutes) Memory Usage (MB)
0 73.3
1 112
2 117
3 117
4 119
5 119
6 119
7 120
8 120
9 120
10 120

@jbphet
Copy link
Contributor Author

jbphet commented Jul 19, 2023

Phet-io memory test in studio, local link = http://localhost:8080/studio/?sim=greenhouse-effect&locales=*&keyboardLocaleSwitcher&phetioWrapperDebug=true&phetioElementsDisplay=all&fuzz

No leak detected, memory usage stabilizes around 146 MB.

Time (minutes) Memory Usage (MB)
0 101
1 138
2 144
3 144
4 143
5 145
6 143
7 143
8 144
9 146
10 146
20 146

@jbphet
Copy link
Contributor Author

jbphet commented Jul 19, 2023

No leaks detected, closing.

@jbphet jbphet closed this as completed Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant