phetsims / phet-core

Core utilities used by all PhET simulations.
MIT License
8 stars 6 forks source link

Investigate Poolable.maxSize to test quickly for memory leaks #55

Open zepumph opened 5 years ago

zepumph commented 5 years ago

From https://github.com/phetsims/sun/issues/432, we think that seeting the maxSize to zero could help us find memory leaks faster.

An idea of another test, manually set the Poolable option maxSize to 0, and see that there would be no slow "tail" increasing the memory as the pools get to their max size.

@jonathanolson said that increasing the number of pooled object allocations in the pool shouldn't be a problem.

This test will be performed by @jbphet to see if there is a memory leak.

@jonathanolson said that phet-core doesn't support query parameters, so we can't support this as a "memory leak testing" query param.

@samreid is interested in this to see if it is a good way to easily find memory leaks quickly, since it involved bypassing the pool.

@jbphet will investigate, report, and bring it back to developer meeting.

jbphet commented 5 years ago

I tested this by setting the pool sizes to zero, which just forces all pool allocations to call the constructor. The result was that the sims use less memory overall, but leaks at the same rate. I think this probably means that it's not a problem with the pools.

There still seems to be a slow memory leak, or maybe it just takes a lot of fuzzing for all of the pools to get full. At any rate, the leak rate as it is now isn't bad enough that it will impact our users, and it's not easy to figure out where it's coming from. I don't feel that it's worth any more of my time to investigate this, and I'll put it up for developer meeting to see if we want to close or have someone else pursue it.

jonathanolson commented 5 years ago

This seems like something that would be beneficial for things I do, so I'm happy to volunteer.