printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
ptr = mcrealloc(ptr1, 120);
- tassert( ptr==ptr1 );
+ tassert( ptr<ptr1 );
printf("mixed:%s free:%d\n", ptr, base->chunk->freesize);
- ptr = mcalloc(base, CNTXCHUNK);
- strcpy(ptr, ptr1);
+ ptr1 = mcalloc(base, CNTXCHUNK);
+ strcpy(ptr1, ptr);
printf("mixed:%s free:%d freenew:%d\n", ptr1, base->chunk->freesize, base->chunk->next->freesize);
- ptr= mcstrdup(child, ptr1);
+ ptr1= mcstrdup(child, ptr);
printf("mixed:%s free:%d freechild:%d\n", ptr1, base->chunk->freesize, child->chunk->freesize);
freeMemoryContext(child);
/* just enlarge */
alloc->cntx->chunk->freesize -= PTRALIGN(size)-realsize;
alloc->size+=PTRALIGN(size)-realsize;
+ memmove( ((char*)alloc) - (PTRALIGN(size)-realsize), alloc, PTRALIGN(size)+MCASHDRSZ );
+ alloc = (MCAllocatedSpace*) ( ((char*)alloc) - (PTRALIGN(size)-realsize) );
+ ptr = (void*)alloc->data;
if ( alloc->cntx->flags & MC_DEBUG ) {
memset( (char*)(alloc->data) + realsize, 0xc3, PTRALIGN(size)-realsize );
*(u_int32_t*)((char*)alloc + alloc->size - sizeof(u_int32_t) ) = MCMAGICKNUMBER;