Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IsBadReadPtr error

Status
Not open for further replies.

dengmb

Programmer
Apr 15, 2004
1
US
I got an Assert failure and program exit. I debug it and find that the error message points to a

IsBadReadPtr(myClassobj , sizeof(*myClassobj)
(myClassObj is a pointer to an object)
I have no clue how it happens, can anyone tell me the reason for this error?
 
It usually happens if pointer is not initialized or when you try to delete an already freed memory.

Ion Filipski
1c.bmp
 
I would analyze the destructor of your class. Also check for static data memebers that could be pointers. I assume you alread know what myClassObj is so search through it and place a break-point or trace statement on every line you "new" and "delete". Also, make sure to set the pointer back to NULL when you do delete it.

Matt
 
One more thing, make sure it is initialized to null upon startup of the class (see Ion's post)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top