-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix double lock in GC_malloc called from backtrace()
Issue #613 (bdwgc). As backtrace() might call a redirected malloc, we need to release the allocator lock temporarily before backtrace() call, and we should not call backtrace() at all for the cases where it is not possible to release the allocator lock temporarily (i.e. for internal allocations). * dbg_mlc.c [DBG_HDRS_ALL] (GC_debug_generic_malloc_inner): Call ADD_CALL_CHAIN_INNER() instead of ADD_CALL_CHAIN(). * include/private/dbg_mlc.h [SAVE_CALL_CHAIN && REDIRECT_MALLOC && THREADS && DBG_HDRS_ALL && NARGS==0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE] (GC_save_callers_no_unlock): Declare function. * include/private/dbg_mlc.h [DBG_HDRS_ALL] (ADD_CALL_CHAIN_INNER): Define. * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC && THREADS && DBG_HDRS_ALL]: Include dbg_mlc.h. * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC && THREADS && DBG_HDRS_ALL] (GC_save_callers_no_unlock): Implement. * os_dep.c [NEED_CALLINFO && SAVE_CALL_CHAIN && NARGS==0 && NFRAMES%2==0 && GC_HAVE_BUILTIN_BACKTRACE && REDIRECT_MALLOC] (GC_save_callers): Wrap backtrace() into UNLOCK/LOCK(); add comment.
- Loading branch information
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters