As I am troubleshooting an issue with threads and memory allocation on
OpenVMS, I have noticed a couple of things.
In util.c the routines Perl_safesysmalloc and friends are updating a
linked list.
There does not seem to be any protection from a different thread also
updating the same linked list at the same time, especially on a
multi-processor system.
I would recommend that either a static routine or macro be used to
insert and remove elements from the linked list, and when a threaded
perl is being built, it compile in taking out a thread mutex during the
operation.
Since normally the header->interpreter value is not poisoned when memory
is free, if something else mallocs the memory right after a free
operation, and then incorrectly calls Perl_safesysfree() to free it,
this will not be detected by Perl_safesysfree.
I just hit this condition because of a bug I introduced into my test
vms/vms.c, where Perl_safesysfree(free) successfully freed memory that
was allocated by malloc().
I would recommend that the header->interpreter value always be poisoned
so that this condition can be better detected.
-John
[EMAIL PROTECTED]
Personal Opinion Only