[fpc-pascal] Disposing pointers and memory leaks

Joseph Montanez jmontanez at gorilla3d.com
Sun Mar 29 11:02:26 CEST 2009


Im struggling to get into memory management and im having issues.

      New(Cursor);
      WriteLn('New Cursor');
      Cursor := DrawPixel(Screen, X, Y, 253, 253, 253);
      WriteLn('Assign Cursor');
      SDL_Flip(Screen);
      WriteLn('Render Cursor');
      {It dies here were did cursor go?}
      Dispose(Cursor);
      WriteLn('Dispose Cursor');

An unhandled exception occurred at $00407C9A :
EAccessViolation : Access violation
  $00407C9A
  $0040182C

It never makes it to Dispose(Cursor);, so my best guess is something
else removed it before I did? Im using SDL library so maybe it cleans
up for me. But if  not then maybe I can getting the wrong idea here.
And if it was removed before I try to remove it is there a way to
check if the pointer is still in memory?



More information about the fpc-pascal mailing list