diff options
author | Rickard Green <[email protected]> | 2016-08-31 15:39:43 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2016-08-31 15:39:43 +0200 |
commit | dafdc7c779b1f6bda54f9a4ea6fb1e26b5e3b096 (patch) | |
tree | 7d38635c30d670bcd1f4aa77e041924cc8db1a68 /erts/emulator/beam/erl_nif.c | |
parent | 74fecb1c89c9f3149dc0e42b2a4a19827a28370f (diff) | |
parent | 2652d2f9b9f58746b80786fe7e62ae36b09bc890 (diff) | |
download | otp-dafdc7c779b1f6bda54f9a4ea6fb1e26b5e3b096.tar.gz otp-dafdc7c779b1f6bda54f9a4ea6fb1e26b5e3b096.tar.bz2 otp-dafdc7c779b1f6bda54f9a4ea6fb1e26b5e3b096.zip |
Merge branch 'maint'
* maint:
Ensure correct mbuf_sz value in process structure
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index f572577bde..bbfc673318 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -156,7 +156,9 @@ static Eterm* alloc_heap_heavy(ErlNifEnv* env, size_t need, Eterm* hp) HEAP_TOP(env->proc) = env->hp; } else { - env->heap_frag->used_size = hp - env->heap_frag->mem; + Uint usz = env->hp - env->heap_frag->mem; + env->proc->mbuf_sz += usz - env->heap_frag->used_size; + env->heap_frag->used_size = usz; ASSERT(env->heap_frag->used_size <= env->heap_frag->alloc_size); } hp = erts_heap_alloc(env->proc, need, MIN_HEAP_FRAG_SZ); @@ -308,11 +310,14 @@ static void full_flush_env(ErlNifEnv* env) HEAP_TOP(c_p) = env->hp; } else { + Uint usz; ASSERT(env->hp_end != HEAP_LIMIT(c_p)); ASSERT(env->hp_end - env->hp <= env->heap_frag->alloc_size); HEAP_TOP(c_p) = HEAP_TOP(env->proc); - env->heap_frag->used_size = env->hp - env->heap_frag->mem; + usz = env->hp - env->heap_frag->mem; + env->proc->mbuf_sz += usz - env->heap_frag->used_size; + env->heap_frag->used_size = usz; ASSERT(env->heap_frag->used_size <= env->heap_frag->alloc_size); @@ -394,9 +399,12 @@ static void flush_env(ErlNifEnv* env) HEAP_TOP(env->proc) = env->hp; } else { + Uint usz; ASSERT(env->hp_end != HEAP_LIMIT(env->proc)); ASSERT(env->hp_end - env->hp <= env->heap_frag->alloc_size); - env->heap_frag->used_size = env->hp - env->heap_frag->mem; + usz = env->hp - env->heap_frag->mem; + env->proc->mbuf_sz += usz - env->heap_frag->used_size; + env->heap_frag->used_size = usz; ASSERT(env->heap_frag->used_size <= env->heap_frag->alloc_size); } } |