Nicholas Clark wrote:
If I build parrot with --gc=libc on OS X I see some warnings about bad
pointers being passed to free(). It's happening in a call from dod.c:

#ifdef GC_IS_MALLOC
                    /* free allocated space at (int*)bufstart - 1,
                     * but not if it is used COW or external
                     */
                    if (PObj_bufstart(b) &&

Brr, when here, buffers are freed, not PMCs....

whereas the flags are set to 0 in pmc_reuse -

... which is totally broken. It must have at least PObj_is_PMC_FLAG set.

Honestly, we have a vtable function morph() which should do the right thing (which is debatable ;). The general pmc_reuse() trys to accomplish too many things at once - and not even all, like freeing mutexes.

What sets the flags to 512 on creation of the String PMC?

Nothing. That flag is on STRING* (buffers) not on the PMC i.e. at the STRING* buffer hanging off PMC_str_val(SELF).


This functionality seems to be missing from the morph code.

The _CLEARALL is the problem AFAIK.

BTW using --gc=malloc is currently untested and for sure slow as hell, when used with ARENA_DOD_FLAGS turned on - all the DOD routines concerning --gc=malloc are lacking optimizations.

Nicholas Clark

leo



Reply via email to