in reply to General memory management for embedded/extended perl with C threads
With iThreads, under Win32, the memory for at least some of perl's internal datastructures is allocated from Thread Local Storage, and is so (at least notionally) only accessible from the thread in which it is created.
There is also (under 5.8.x at least) a C++ class wrapped around an OS provided LocalMemAlloc() API.
If either of these are the case with the version of Perl you are using, which is quite possible as iThreads evolved initially as a substitute for fork on Win32 in 5.6.1; and if you are allocating memory from the global heap in your C threads; and you are trying to share the two types of memory across both types of threads--this may explain (some) of your problems.
There are a lot of 'ifs' in that, and it may be a complete red herring, but like you I have attempted to track through the memory allocation macros used by Perl (5.8.5 in my case) and they are incredibly deeply nested and very hard to follow.
I think that your best source of advice would be the p5p list, and if your working on Win32 maybe the perl-win32 porters list also.
|
|---|