community.borland.com

Article #15934: DEBUGGER - POINTERS CORRUPTING MEMORY?

 Technical Notes Database

TN934D.txt   DEBUGGER - POINTERS CORRUPTING MEMORY?
Category   :Pascal
Platform    :All
Product    :Turbo Pascal  5.0 5.5

Description:
Q. How can I tell if a pointer could be corrupting my code or data segments?
A. Normally, pointers point to areas located in Turbo Pascal's heap. You can
  determine if a pointer is pointing outside of the heap by comparing its
  segment value to that of HEAPORG (a predefined pointer establishing the
  beginning of normal heap space).  This comparison is best done by placing a
  Watch on both HEAPORG and any pointers that you suspicious of.  If your
  pointers have segment values less than that of HEAPORG when an assignment
  is made to them then memory corruption is likely.  To correct the situation,
  ensure that all pointers are initialized with either the NEW or GETMEM
  procedures.


Reference:


7/16/98 4:35:37 PM
 

Last Modified: 01-SEP-99