Closed marlitas closed 1 month ago
I did a memory leak test in phet bran and it indicates there's a leak. I'll investigate.
Some investigation has led me to investigating MixedFractionNode. I am now removing the calculationNode's children at the top of the multilink that creates the MixedFractionNode, but it seems to still be hanging onto some layout listeners. I'm not sure why since I would assume removing it from the calculationNode would sever all ties.
MixedFractionNode is also used in fraction-common
, so I'm going to investigate to see if this is a sim-specific memory leak, or something that is happening with MixedFractionNode in general.
I looked at Fractions: Mixed Numbers and the sim does not create a new MixedFractionNode
every time the fraction changes. This makes me think that the memory leak might be part of how MixedFractionNode
is working. However, it also made me wonder if there's a better way to use MixedFractionNode
. Do we actually have to create a new one each time or can we modify the original?
I did another memory test with this patch:
And it looks like the sim is doing better, but the memory leak is not completely gone:
JO pointed out some super helpful things in https://github.com/phetsims/scenery-phet/issues/857. I went ahead and changed the logic in MeanCalculationPanel so that we are not passing through a visibleProperty on each multilink call. Looks like it's working well.
New memory test is looking good in phet-brand.
Test on phet-io brand looks good as well. Closing.
In preparation for code review we are running a few memory leak tests.