diff options
author | Sverker Eriksson <[email protected]> | 2015-12-09 18:40:46 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-12-09 18:40:46 +0100 |
commit | daff6d2d3a91a70d3e6500e90f28d2339ec6fba3 (patch) | |
tree | b73badd8f23e97a216ef520a9ab7b0cc6ec64c14 /erts/emulator/beam/erl_message.c | |
parent | 5690f3b07d4589ef9f843e8e9a96300bae492dee (diff) | |
parent | 7016d21eb3bec1bfb9381292be9f31cc25eadb03 (diff) | |
download | otp-daff6d2d3a91a70d3e6500e90f28d2339ec6fba3.tar.gz otp-daff6d2d3a91a70d3e6500e90f28d2339ec6fba3.tar.bz2 otp-daff6d2d3a91a70d3e6500e90f28d2339ec6fba3.zip |
Merge branch 'sverk/dist-ctrl-msg-overflow-master' into master
* sverk/dist-ctrl-msg-overflow-master:
erts: Tweak hashmap heap size estimation
erts: Fix bug for remote control message containing fat maps
erts: Add test for remote exit signal with fat map
erts: Fix bug in heap_factory_undo for FACTORY_HEAP_FRAGS mode
Diffstat (limited to 'erts/emulator/beam/erl_message.c')
-rw-r--r-- | erts/emulator/beam/erl_message.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c index 766e0bf52a..ac5ec79fe4 100644 --- a/erts/emulator/beam/erl_message.c +++ b/erts/emulator/beam/erl_message.c @@ -1577,6 +1577,9 @@ void erts_factory_selfcontained_message_init(ErtsHeapFactory* factory, ASSERT(factory->hp >= factory->hp_start && factory->hp <= factory->hp_end); } +/* One static sized heap that must suffice. + No extra heap fragments will be allocated. +*/ void erts_factory_static_init(ErtsHeapFactory* factory, Eterm* hp, Uint size, @@ -1591,6 +1594,23 @@ void erts_factory_static_init(ErtsHeapFactory* factory, factory->off_heap_saved.overhead = factory->off_heap->overhead; } +/* A temporary heap with default buffer allocated/freed by client. + * factory_close is same as factory_undo + */ +void erts_factory_tmp_init(ErtsHeapFactory* factory, Eterm* hp, Uint size, + Uint32 atype) +{ + factory->mode = FACTORY_TMP; + factory->hp_start = hp; + factory->hp = hp; + factory->hp_end = hp + size; + factory->heap_frags = NULL; + factory->off_heap_saved.first = NULL; + factory->off_heap_saved.overhead = 0; + factory->off_heap = &factory->off_heap_saved; + factory->alloc_type = atype; +} + /* When we know the term is an immediate and need no heap. */ void erts_factory_dummy_init(ErtsHeapFactory* factory) @@ -1641,6 +1661,7 @@ static void reserve_heap(ErtsHeapFactory* factory, Uint need, Uint xtra) else { /* Fall through */ case FACTORY_HEAP_FRAGS: + case FACTORY_TMP: bp = factory->heap_frags; } @@ -1706,6 +1727,9 @@ void erts_factory_close(ErtsHeapFactory* factory) bp->used_size = factory->hp - bp->mem; } break; + case FACTORY_TMP: + erts_factory_undo(factory); + break; case FACTORY_STATIC: break; case FACTORY_CLOSED: break; default: @@ -1832,8 +1856,20 @@ void erts_factory_undo(ErtsHeapFactory* factory) factory->message->data.heap_frag = factory->heap_frags; erts_cleanup_messages(factory->message); break; + case FACTORY_TMP: case FACTORY_HEAP_FRAGS: - free_message_buffer(factory->heap_frags); + erts_cleanup_offheap(factory->off_heap); + factory->off_heap->first = NULL; + + bp = factory->heap_frags; + while (bp != NULL) { + ErlHeapFragment* next_bp = bp->next; + + ASSERT(bp->off_heap.first == NULL); + ERTS_HEAP_FREE(factory->alloc_type, (void *) bp, + ERTS_HEAP_FRAG_SIZE(bp->alloc_size)); + bp = next_bp; + } break; case FACTORY_CLOSED: break; |