aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_gc.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2010-07-21 15:42:42 +0200
committerPatrik Nyblom <[email protected]>2010-08-12 14:55:42 +0200
commitd3f229d4f311c218d6a92f575f63feb3a02eb68c (patch)
tree77eeb3b63d7ae427d320914d6ab5c2fd3e60631a /erts/emulator/beam/erl_gc.c
parent871fdb232d7facc58c202ef81634a12fbdcfefb4 (diff)
downloadotp-d3f229d4f311c218d6a92f575f63feb3a02eb68c.tar.gz
otp-d3f229d4f311c218d6a92f575f63feb3a02eb68c.tar.bz2
otp-d3f229d4f311c218d6a92f575f63feb3a02eb68c.zip
Fix wrapping in next vheap calculation
OTP #8730
Diffstat (limited to 'erts/emulator/beam/erl_gc.c')
-rw-r--r--erts/emulator/beam/erl_gc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index adc50675bf..38cc6195fb 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -1999,18 +1999,27 @@ do_next_vheap_size(Uint vheap, Uint vheap_sz) {
*
* ----------------------
*/
+ Uint vheap_max = heap_sizes[num_heap_sizes - 1];
+ if (vheap_sz == vheap_max) {
+ return vheap_sz;
+ }
- if (vheap > (Uint) (vheap_sz*3/4)) {
+ if ((Uint) vheap/3 > (Uint) (vheap_sz/4)) {
+ Uint new_vheap_sz = vheap_sz;
- while(vheap > (Uint) (vheap_sz*3/4)) {
- vheap_sz = vheap_sz*2;
+ while((Uint) vheap/3 > (Uint) (vheap_sz/4)) {
+ new_vheap_sz = (vheap_sz << 1);
+ if (new_vheap_sz < vheap_sz || new_vheap_sz > vheap_max ) {
+ return vheap_max;
+ }
+ vheap_sz = new_vheap_sz;
}
return erts_next_heap_size(vheap_sz, 0);
}
if (vheap < (Uint) (vheap_sz/4)) {
- return erts_next_heap_size((Uint) (vheap_sz / 2), 0);
+ return erts_next_heap_size((Uint) (vheap_sz >> 1), 0);
}
return vheap_sz;