Causes of Heap Corruption
Your program can cause heap corruption in several ways, including:
- Using too large a value to index an array. If the adjacent memory is allocated to another object, the program will overwrite that object's data.
- Casting a pointer to a data type larger than the original allocation's data type. If the adjacent memory is allocated to another object, the program will overwrite that object's data when it accesses a data field outside the original allocation.
- Deleting an object prematurely while retaining a pointer to it. When the operating system allocates the memory for new data, the program will overwrite the old data with the new data.
- (COM only) Releasing all pointers to a particular COM interface in a subprogram while retaining a COM pointer to that interface in the calling subprogram. When your program releases the last COM pointer in the subprogram, the operating system will mark that interface and all its methods and data items as not valid. If the calling subprogram then uses its own COM pointer, the system will generate an access violation.
This Help system was created using a trial version of Adobe RoboHelp. Files generated with the trial version are intended for evaluation purposes only and may not be used or distributed for any other purpose.