aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_process.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2015-11-16 11:21:49 +0100
committerRickard Green <[email protected]>2015-12-08 14:47:41 +0100
commitac529b0326496e52f3289464f9410001bc3bde6d (patch)
treeb24f2b6ae7b3ad368b70975e60c98a7a0e561981 /erts/emulator/beam/erl_process.c
parente8f6435d3c932a03101c12a1263d355112e399bf (diff)
downloadotp-ac529b0326496e52f3289464f9410001bc3bde6d.tar.gz
otp-ac529b0326496e52f3289464f9410001bc3bde6d.tar.bz2
otp-ac529b0326496e52f3289464f9410001bc3bde6d.zip
Fix memory leaks
Diffstat (limited to 'erts/emulator/beam/erl_process.c')
-rw-r--r--erts/emulator/beam/erl_process.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 9acce8acb6..ebb4d323e6 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -11259,6 +11259,7 @@ erts_cleanup_empty_process(Process* p)
static void
delete_process(Process* p)
{
+ Eterm *heap;
VERBOSE(DEBUG_PROCESSES, ("Removing process: %T\n",p->common.id));
/* Cleanup psd */
@@ -11283,16 +11284,17 @@ delete_process(Process* p)
* Release heaps. Clobber contents in DEBUG build.
*/
-
-#ifdef DEBUG
- sys_memset(p->heap, DEBUG_BAD_BYTE, p->heap_sz*sizeof(Eterm));
-#endif
-
#ifdef HIPE
hipe_delete_process(&p->hipe);
#endif
- ERTS_HEAP_FREE(ERTS_ALC_T_HEAP, (void*) p->heap, p->heap_sz*sizeof(Eterm));
+ heap = p->abandoned_heap ? p->abandoned_heap : p->heap;
+
+#ifdef DEBUG
+ sys_memset(heap, DEBUG_BAD_BYTE, p->heap_sz*sizeof(Eterm));
+#endif
+
+ ERTS_HEAP_FREE(ERTS_ALC_T_HEAP, (void*) heap, p->heap_sz*sizeof(Eterm));
if (p->old_heap != NULL) {
#ifdef DEBUG
@@ -11311,6 +11313,9 @@ delete_process(Process* p)
free_message_buffer(p->mbuf);
}
+ if (p->msg_frag)
+ erts_cleanup_messages(p->msg_frag);
+
erts_erase_dicts(p);
/* free all pending messages */