Text archives Help
- From: Andrew Kensler <aek@cs.utah.edu>
- To: bigler@sci.utah.edu
- Cc: MANTA <manta@sci.utah.edu>
- Subject: Re: [MANTA] memalign
- Date: Mon, 9 Apr 2007 01:48:20 -0600 (MDT)
>
Also, I was trying to figure out a way that would allow the deallocation
>
of a pointer that was moved around (like memalign or self coded one
>
does). This would require some book keeping, though.
You could emulate the approach used by some memory allocators. The book
keeping information is placed a fixed position before the returned
pointer. When free is called, it just cast the pointer and then subtracts
an offset to get to the data in the block. You could use the same
approach to return an adjusted pointer to the client code and store the
actual pointer from new or malloc just before it.
- Andrew
Archive powered by MHonArc 2.6.16.