GameMonkey Script
http://www.gmscript.com/gamemonkey/forum/

bug in gmMachine::CollectGarbage
http://www.gmscript.com/gamemonkey/forum/viewtopic.php?f=6&t=538
Page 1 of 1

Author:  DrEvil-OB [ Fri Mar 12, 2010 2:16 pm ]
Post subject:  bug in gmMachine::CollectGarbage

In gmMachine::CollectGarbage, there is some code that can resize the hard and soft memory limits automatically to account for real memory usage. The symptom of this bug is that the memory limits don't resize properly, resulting in a full collect being done every frame as it attempts to compensate. I noticed this in my app after a 10 minute period resulted in over 12000 full collects.

Simple fix
Code:
int newHard = (int)(GMMACHINE_GC_HARD_MEM_INC_FRAC_OF_USED * (float)afterMemUsage);
int newSoft = (int)(GMMACHINE_GC_SOFT_MEM_DEFAULT_FRAC_OF_HARD * (float)GetDesiredByteMemoryUsageHard());


should be
Code:
int newHard = (int)(GMMACHINE_GC_HARD_MEM_INC_FRAC_OF_USED * (float)afterMemUsage);
int newSoft = (int)(GMMACHINE_GC_SOFT_MEM_DEFAULT_FRAC_OF_HARD * (float)newHard);

Author:  Greg [ Sat Mar 13, 2010 8:57 am ]
Post subject:  Re: bug in gmMachine::CollectGarbage

Thanks DrEvil, I'll have a look into this. It does appear I'm using the old value instead of the new value to recalibrate.

Author:  Greg [ Sun Mar 14, 2010 11:38 pm ]
Post subject:  Re: bug in gmMachine::CollectGarbage

I've looked at the code and tested the fix, looks good DrEvil. I've updated my build to 1.26.2 with this change.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/