Crashes in Intel C++ Compiler, doesn't crash in Microsoft VS2005 C++ Compiler -- HELP!

jimdempseyatthecove
Total Points:
36,397
Status Points:
36,397
Black Belt
January 19, 2009 8:08 AM PST
Rate
 
#6 Reply to #5

Although the crash may not have occured, you may have trashed memory (or will trash memory shortly) by using delete [] in place of delete. delete [] requires that an array of objects be allocated to the pointer (even if it is an array of 1 element). In the array allocation, preceeding the pointer to the 1st element is a header containing an additional count information. Depending on the heap manager the count field may require a different header than the single object new allocation. If the headers are different then what would appeare to be the count field of the header (for single object allocated) may very will contain junk (some number other than 1 when interpreted as an array allocation object list for deallocation). Then if the dtor is not null then the damage will likely occure immediately. If the dtor is null and if the header for the single object allocate is a different size as the array of objects allocation header then the crash may occure some time later as you will likely be returning what would appear to be a corrupted allocation.

Jim Dempsey



--------

Blog: The Parallel Void


www.quickthreadprogramming.com


Intel Software Network Forums Statistics

8481 users have contributed to 31614 threads and 100679 posts to date.
In the past 24 hours, we have 31 new thread(s) 115 new posts(s), and 168 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member rohit5575