[Solved] Invalid Pointer Operation – Delphi XE


An Invalid Pointer exception is thrown by the memory manager when it tries to free invalid memory. There are three ways this can happen.

The most common is because you’re trying to free an object that you’ve already freed. If you turn on FastMM’s FullDebugMode, it will detect this and point you directly to the problem. (But make sure to build a map file so it will have the information it needs to create useful stack traces from.)

The second way is if you’re trying to free memory that was allocated somewhere other than the memory manager. I’ve seen this a few times when passing a string from a Delphi EXE to a Delphi DLL that wasn’t using the shared memory manager feature.

And the third way involves messing around with pointers directly and probably doesn’t apply to you. If you try to FreeMem or Dispose a bad pointer that doesn’t refer to an actual block of memory allocated by FastMM, you’ll get this error.

It’s most likely the first one. Use FullDebugMode and you’ll find the source of the problem easily.

2

solved Invalid Pointer Operation – Delphi XE