IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 20 years ago

Closed 20 years ago

#803 closed defect (fixed)

psRealloc simply calls realloc without reference to the psAlloc mem manager

Reported by: rhl@… Owned by: robert.desonia@…
Priority: high Milestone:
Component: sys Version: unspecified
Severity: normal Keywords:
Cc:

Description

psRealloc calls realloc on a block that belongs to the psLib memory allocator; unfortunately,
that allocator assumes that blocks have sizes that are powers of two (up to 216; but see bug 804)
and this is violated by a call to realloc().

A simple fix is to call psAlloc to get the expanded memory block (if needed); I have implemented
this and will check it in after suitable consultation

Change History (3)

comment:1 by Paul Price, 20 years ago

Cc: price@… added
Owner: changed from David.Robbins@… to robert.desonia@…

comment:2 by Paul Price, 20 years ago

* Bug 801 has been marked as a duplicate of this bug. *

comment:3 by Paul Price, 20 years ago

Resolution: fixed
Status: newclosed

Rolled back the psAlloc + copy solution (see bug 801) and instead added to the
top of p_psRealloc:

Ensure the size matches that of the recycle bin
int bin = getRecycleBin(size);
if (bin < N_RECYCLE_BINS) {

size = recycleBinSize[bin]; round-up size to next sized bin.

}

This ensures that the size returned from realloc() is a power of two.

Note that you now need to define PS_MEM_USE_RECYCLE at compile time to use
recycling bins.

Note: See TracTickets for help on using tickets.