in reply to Re: XS malloc and free (whose)
in thread XS malloc and free
If I got the function pointer syntax right then something like this would be a workaround maybe?
void (perls_free)( void*p ) = &free; #undef free // free() should now refer to the crt free() and use perls_free() for +XS
Though the long term solution would be to remove the #define from the header file in favour of Safefree().
That said, the whole area of memory allocation functions and macro's in the Perl codebase is a mess. Sometime last year I did a not totally crude grep and eliminate duplicates process on the sources and discovered that between the 4 basic functions--malloc(), calloc(), realloc() & free()--there were (from memory) 114 different ways of calling them through the multiplicitous variations of functions and macros. It's truely amazing that there are many more memory problems than there are.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XS malloc and free (whose)
by tye (Sage) on Feb 07, 2006 at 20:26 UTC | |
by BrowserUk (Patriarch) on Feb 07, 2006 at 20:59 UTC | |
by Brutha (Friar) on Feb 08, 2006 at 07:08 UTC | |
by BrowserUk (Patriarch) on Feb 08, 2006 at 08:08 UTC |