diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-02-04 19:09:17 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-02-04 19:09:17 +0000 |
commit | 7cb608b5fc09aa914d5f91646e40ed772b6bac01 (patch) | |
tree | d87bee4dbd1d4300ece1a4a3ecc9d640f43495ed /pod | |
parent | d79395463b4ec08db7bfe67c427a8c654b5904d6 (diff) | |
download | perl-7cb608b5fc09aa914d5f91646e40ed772b6bac01.tar.gz |
Enhance PERL_TRACK_MEMPOOL so that it also emulates the PerlHost
behaviour of freeing up all memory at thread exit. With this and
tools such as valgrind you will now get warnings as soon as you
read from the deallocated memory, rather than just a warning much
later about freeing to the wrong pool.
p4raw-id: //depot/perl@27084
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perltodo.pod | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/pod/perltodo.pod b/pod/perltodo.pod index d8d8a007ed..2be4e68d08 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -367,38 +367,6 @@ anyone feeling like exercising their skill with coverage and profiling tools might want to determine what ops I<really> are the most commonly used. And in turn suggest evictions and promotions to achieve a better F<pp_hot.c>. -=head2 emulate the per-thread memory pool on Unix - -For Windows, ithreads allocates memory for each thread from a separate pool, -which it discards at thread exit. It also checks that memory is free()d to -the correct pool. Neither check is done on Unix, so code developed there won't -be subject to such strictures, so can harbour bugs that only show up when the -code reaches Windows. - -It would be good to be able to optionally emulate the Window pool system on -Unix, to let developers who only have access to Unix, or want to use -Unix-specific debugging tools, check for these problems. To do this would -involve figuring out how the C<PerlMem_*> macros wrap C<malloc()> access, and -providing a layer that records/checks the identity of the thread making the -call, and recording all the memory allocated by each thread via this API so -that it can be summarily free()d at thread exit. One implementation idea -would be to increase the size of allocation, and store the C<my_perl> pointer -(to identify the thread) at the start, along with pointers to make a linked -list of blocks for this thread. To avoid alignment problems it would be -necessary to do something like - - union memory_header_padded { - struct memory_header { - void *thread_id; /* For my_perl */ - void *next; /* Pointer to next block for this thread */ - } data; - long double padding; /* whatever type has maximal alignment constraint */ - }; - - -although C<long double> might not be the only type to add to the padding -union. - =head2 reduce duplication in sv_setsv_flags C<Perl_sv_setsv_flags> has a comment |