From: Vincent Pit Date: Thu, 19 Mar 2015 16:08:35 +0000 (-0300) Subject: Release UID global memory at global teardown time X-Git-Tag: v0.27~15 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=c50db90df8e42e68dbec0a73acc5010cc951d19d Release UID global memory at global teardown time --- diff --git a/Upper.xs b/Upper.xs index bb4300d..272028d 100644 --- a/Upper.xs +++ b/Upper.xs @@ -2211,6 +2211,13 @@ static void su_global_teardown(pTHX_ void *root) { return; #endif + SU_LOCK(&su_uid_seq_counter_mutex); + PerlMemShared_free(su_uid_seq_counter.seqs); + su_uid_seq_counter.size = 0; + SU_UNLOCK(&su_uid_seq_counter_mutex); + + MUTEX_DESTROY(&su_uid_seq_counter_mutex); + su_initialized = 0; return; @@ -2235,8 +2242,10 @@ static void su_global_setup(pTHX_ SU_XS_FILE_TYPE *file) { MUTEX_INIT(&su_uid_seq_counter_mutex); + SU_LOCK(&su_uid_seq_counter_mutex); su_uid_seq_counter.seqs = NULL; su_uid_seq_counter.size = 0; + SU_UNLOCK(&su_uid_seq_counter_mutex); stash = gv_stashpv(__PACKAGE__, 1); newCONSTSUB(stash, "TOP", newSViv(0));