Skip to content
Browse files

erts: Fix memory leak caused by race on exiting process

Seen with valgrind running ets_SUITE:delete_large_tab
or delete_large_named_table.
  • Loading branch information...
1 parent f2ea927 commit 73e6d0f2b775e9ff8d65ccdb2dfbef2cb211e91a @sverker sverker committed Mar 30, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 erts/emulator/beam/erl_process_lock.h
View
4 erts/emulator/beam/erl_process_lock.h
@@ -958,8 +958,6 @@ erts_pid2proc_opt(Process *c_p,
if (flags & ERTS_P2P_FLG_TRY_LOCK)
proc = ERTS_PROC_LOCK_BUSY;
else {
- if (flags & ERTS_P2P_FLG_SMP_INC_REFC)
- proc->lock.refc++;
#ifdef ERTS_ENABLE_LOCK_COUNT
erts_lcnt_proc_lock_unaquire(&proc->lock, lcnt_locks);
#endif
@@ -969,6 +967,8 @@ erts_pid2proc_opt(Process *c_p,
pid_need_locks,
pix_lock,
flags);
+ if (proc && (flags & ERTS_P2P_FLG_SMP_INC_REFC))
+ proc->lock.refc++;
}
}
}

0 comments on commit 73e6d0f

Please sign in to comment.
Something went wrong with that request. Please try again.