aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-03-30 09:11:57 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-03-30 09:11:57 +0200
commitaa13ab92a4bc99bffdb1576690d1b62be8d34e4a (patch)
treea1c1ffe5d6140b51abf66b663ffb197b143ef542 /erts
parent346fb20cc0eb84a4ed9758d39ec41bea76ed6999 (diff)
parent9a36246ad24561619e182d488d4c8a6825011d34 (diff)
downloadotp-aa13ab92a4bc99bffdb1576690d1b62be8d34e4a.tar.gz
otp-aa13ab92a4bc99bffdb1576690d1b62be8d34e4a.tar.bz2
otp-aa13ab92a4bc99bffdb1576690d1b62be8d34e4a.zip
Merge branch 'egil/fix-maps-new_map-instruction'
* egil/fix-maps-new_map-instruction: erts: Eliminate potential heap fragments after Map creation
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/beam_emu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 8fcdc72895..fdb84aae42 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -6573,6 +6573,7 @@ new_map(Process* p, Eterm* reg, BeamInstr* I)
ptr = &Arg(4);
if (n > 2*MAP_SMALL_MAP_LIMIT) {
+ Eterm res;
if (HeapWordsLeft(p) < n) {
erts_garbage_collect(p, n, reg, Arg(2));
}
@@ -6589,7 +6590,15 @@ new_map(Process* p, Eterm* reg, BeamInstr* I)
p->htop = mhp;
factory.p = p;
- return erts_hashmap_from_array(&factory, thp, n/2, 0);
+ res = erts_hashmap_from_array(&factory, thp, n/2, 0);
+ if (p->mbuf) {
+ Uint live = Arg(2);
+ reg[live] = res;
+ erts_garbage_collect(p, 0, reg, live+1);
+ res = reg[live];
+ E = p->stop;
+ }
+ return res;
}
if (HeapWordsLeft(p) < need) {