aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/external.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-11-13 18:46:17 +0100
committerSverker Eriksson <[email protected]>2013-11-21 15:04:37 +0100
commit1f09936f34f5daee534bbfde4f16e5bbb434b6c4 (patch)
tree6c1c37e0d3505ddb0a56db763c57ec3a35366083 /erts/emulator/beam/external.c
parent522a29666088d5d96956d2752ffb1596d778cffd (diff)
downloadotp-1f09936f34f5daee534bbfde4f16e5bbb434b6c4.tar.gz
otp-1f09936f34f5daee534bbfde4f16e5bbb434b6c4.tar.bz2
otp-1f09936f34f5daee534bbfde4f16e5bbb434b6c4.zip
erts: Yield after trapping term_to_binary if gc has been ordered
or if "too much" offheap binaries has been built
Diffstat (limited to 'erts/emulator/beam/external.c')
-rw-r--r--erts/emulator/beam/external.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index d5f3b19b82..7dc7ba6f98 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -1058,8 +1058,11 @@ static BIF_RETTYPE term_to_binary_trap_1(BIF_ALIST_1)
ASSERT(BIF_P->flags & F_DISABLE_GC);
BIF_TRAP1(&term_to_binary_trap_export,BIF_P,res);
} else {
- erts_set_gc_state(BIF_P, 1);
- BIF_RET(res);
+ if (erts_set_gc_state(BIF_P, 1)
+ || MSO(BIF_P).overhead > BIN_VHEAP_SZ(BIF_P))
+ ERTS_BIF_YIELD_RETURN(BIF_P, res);
+ else
+ BIF_RET(res);
}
}