Use shared memory for sv_debug_file
With -DDEBUGGING -Accflags=-DDEBUG_LEAKING_SCALARS -Duseithreads:
use threads;
use threads::shared;
my @shared_ary :shared;
$shared_ary[0] = &threads::shared::share({});
@shared_ary = ();
__END__
panic: free from wrong pool, 881c00!=800000.
Scalars leaked: 1
threads::shared has to juggle multiple interpreters. Sometimes the
interpreter it is calling into (and passing as the first argument
via pTHX) is not actually the current thread as far as the OS is
concerned.
Perl_safesysfree in util.c does not take a pTHX parameter, so it
fetches the current interpreter from the data associated with the cur-
rent thread.
The result is that PERL_TRACK_MEMPOOL complains that the file name
associated with an SV under DEBUG_LEAKING_SCALARS is being freed from
the wrong interpreter.
Using shared memory for the file name solves the issue.