Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix overflow on 32 bit systems in is_full_collection()
In order to figure out whether a full GC should be made the code has logic which calculates the percentage of 'promoted' bytes as part of the resident set size. If the calculated percentage is equal to or larger than MVM_GC_GEN2_THRESHOLD_PERCENT a full collection will be made. However, the code which calculate the percent_growth does not work properly on 32 bit systems due to the fact that size_t is only 32 bits on such systems. When 'promoted' was multiplied by 100 an overflow would occur as soon as that variable contained a large enough value. This, in turn, would lead to a situation where a full collection would never be made which in the end lead to an out of memory error. Changing the type of the variable 'promoted' to MVMuint64 fixes the problem on 32 bit systems. The problem didn't appear on 64-bit systems since size_t is 64 bits there.
- Loading branch information