When calculating allowance, don't blindly cast from double to uint as it might not...
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 17 Jul 2012 16:23:03 +0000 (13:23 -0300)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 17 Jul 2012 17:59:58 +0000 (14:59 -0300)
commit7dbd43e8878c613560ebb7a9cbd9ecb38bd3c37b
tree84aec9a8bfca3110feabf31e107fefc839b1fca2
parentcd44e7caeee8acce22e5e096baa361f34571a364
When calculating allowance, don't blindly cast from double to uint as it might not saturate the result.

* sgen-gc.c (try_calculate_minor_collection_allowance): For workloads with very high
survival rates the calculated allowance_target can overflow a mword on 32bits systems.
Given this behavior is unspecified and we've been bitten by it, let's take the safe
side and manually saturate it.
mono/metadata/sgen-conf.h
mono/metadata/sgen-memory-governor.c