Another option would be to to the entire check, with a special memory
manager.
Let the memory manager, add a byte to each request (probably 4 bytes for
boundaries), and add a ref-counting like structure. This would only be
used by "const param" => const param can use this to mark the block of
memory (never mind if it is a string or elsewhat) as referenced =>
trying to free it, will cause an error
One could even add checksumming the memory...
Ok, probably to much...
On 23/06/2011 22:24, Martin wrote:
On 23/06/2011 22:13, Florian Klämpfl wrote:
Am 23.06.2011 23:03, schrieb Martin:
And what exactly does checkpointer check?
Check if the pointer points into a allocated memory block.
Ok, that would actually work.
even without keep_released it could catch quite some
It should check, that it points to the correct place inside an
allocated block (That is String^ := AllocAddr + SizeOf(StringLen) +
SizeOf(StrRefCnt)
It could even check, that the refcount is not zero.
If the memory has not yet been reallocated, that should fail, if the
string was released (assuming the last DecRefCnt, actually set's it to
zero, before releasing the memory) (Would not work with -gt => since
then all values are trashed)
It would definitely be a good start.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel