diff options
author | Eric Wong <mwrap-perl@80x24.org> | 2022-09-04 07:44:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-09-15 17:39:04 +0000 |
commit | 3197316f33fdc5d487c5bdbb9eb029d443d3c8bf (patch) | |
tree | d2fc84e8396284c86420a65edf927f5d6e5f9722 | |
parent | 5b3ff6f67c97a77809072065e4cafe544609922c (diff) | |
download | mwrap-3197316f33fdc5d487c5bdbb9eb029d443d3c8bf.tar.gz |
This allows us to start tracking allocations before Perl calls our BOOT code, which can be far later if it has to boot other modules first. As an LD_PRELOAD, the constructor can fire before Perl's main().
-rw-r--r-- | Mwrap.xs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -144,6 +144,10 @@ __attribute__((constructor)) static void resolve_malloc(void) } #endif /* !__FreeBSD__ */ } + CMM_STORE_SHARED(totals, lfht_new()); + if (!CMM_LOAD_SHARED(totals)) + fprintf(stderr, "failed to allocate totals table\n"); + err = pthread_atfork(call_rcu_before_fork, call_rcu_after_fork_parent, call_rcu_after_fork_child); @@ -805,9 +809,6 @@ BOOT: #ifndef PERL_IMPLICIT_CONTEXT root_locating = &locating; #endif - CMM_STORE_SHARED(totals, lfht_new()); - if (!CMM_LOAD_SHARED(totals)) - fprintf(stderr, "failed to allocate totals table\n"); PROTOTYPES: ENABLE |