Heap Corruption Durning Streamin
-
Hi I posted this yesterday by mistake in the CLI forum, so I am reposting here. I am getting a heap corruption in my stream in function. I have a global variable, which keep count of the number of records I stream in the exception happens when the record count is 0x197e When I insert the following code
if (nummachine == 0x000000000000196E)
__debugbreak();and step thru the code everythibg works fine the amount of characters i am streaming (as I said I am able to complete the process with the above code is 0x7604d0 or 7,734480 decimal I use the following code
RichListing->LimitText(0x780000);
though the function says that is intended for RTF code here is the stack frame when I get the exception any debugging ideas would be much appreciated. Thank you. ntdll.dll!RtlReportCriticalFailure() Unknown ntdll.dll!RtlpHeapHandleError() Unknown ntdll.dll!RtlpHpHeapHandleError() Unknown ntdll.dll!RtlpLogHeapFailure() Unknown ntdll.dll!RtlpHeapFindListLookupEntry() Unknown ntdll.dll!RtlpFindEntry() Unknown ntdll.dll!RtlpAllocateHeap() Unknown ntdll.dll!RtlpAllocateHeapInternal() Unknown riched20.dll!CTxtArray::AddBlock(long,long) Unknown riched20.dll!CTxtArray::SplitBlock(long,long,long,long,int) Unknown riched20.dll!CTxtPtr::InsertRange(long,unsigned short const *) Unknown riched20.dll!CRchTxtPtr::ReplaceRange(long,long,unsigned short const *,class IUndoBuilder *,long,long *,unsigned long) Unknown riched20.dll!CTxtRange::ReplaceRange(long,unsigned short const *,class IUndoBuilder *,enum SELRR,long *,unsigned long) Unknown riched20.dll!CTxtRange::CheckLimitReplaceRange(long,unsigned short const *,int,class IUndoBuilder *,unsigned long,long *,long,int,unsigned long) Unknown riched20.dll!CTxtRange::CleanseAndReplaceRange(long,unsigned short const *,int,class IUndoBuilder *,unsigned short *,long *,unsigned long) Unknown riched20.dll!CLightDTEngine::ReadPlainText(class CTxtRange *,struct _editstream *,int,class IUndoBuilder *,long) Unknown riched20.dll!CLightDTEngine::LoadFromEs(class CTxtRange *,long,struct _editstream *,int,class IUndoBuilder *) Unknown riched20.dll!CTxtEdit::TxSendMessage(unsigned int,unsigned __int64,__int64,__int64 *) Unknown riched20.dll!RichEditWndProc() Unknown riched20.dll!RichEditANSIWndProc() Unknown user32.dll!UserCallWinProcCheckWow() Unknown user32.dll!CallWindowProcAorW(__int64 ,struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,int) Unknown
-
Hi I posted this yesterday by mistake in the CLI forum, so I am reposting here. I am getting a heap corruption in my stream in function. I have a global variable, which keep count of the number of records I stream in the exception happens when the record count is 0x197e When I insert the following code
if (nummachine == 0x000000000000196E)
__debugbreak();and step thru the code everythibg works fine the amount of characters i am streaming (as I said I am able to complete the process with the above code is 0x7604d0 or 7,734480 decimal I use the following code
RichListing->LimitText(0x780000);
though the function says that is intended for RTF code here is the stack frame when I get the exception any debugging ideas would be much appreciated. Thank you. ntdll.dll!RtlReportCriticalFailure() Unknown ntdll.dll!RtlpHeapHandleError() Unknown ntdll.dll!RtlpHpHeapHandleError() Unknown ntdll.dll!RtlpLogHeapFailure() Unknown ntdll.dll!RtlpHeapFindListLookupEntry() Unknown ntdll.dll!RtlpFindEntry() Unknown ntdll.dll!RtlpAllocateHeap() Unknown ntdll.dll!RtlpAllocateHeapInternal() Unknown riched20.dll!CTxtArray::AddBlock(long,long) Unknown riched20.dll!CTxtArray::SplitBlock(long,long,long,long,int) Unknown riched20.dll!CTxtPtr::InsertRange(long,unsigned short const *) Unknown riched20.dll!CRchTxtPtr::ReplaceRange(long,long,unsigned short const *,class IUndoBuilder *,long,long *,unsigned long) Unknown riched20.dll!CTxtRange::ReplaceRange(long,unsigned short const *,class IUndoBuilder *,enum SELRR,long *,unsigned long) Unknown riched20.dll!CTxtRange::CheckLimitReplaceRange(long,unsigned short const *,int,class IUndoBuilder *,unsigned long,long *,long,int,unsigned long) Unknown riched20.dll!CTxtRange::CleanseAndReplaceRange(long,unsigned short const *,int,class IUndoBuilder *,unsigned short *,long *,unsigned long) Unknown riched20.dll!CLightDTEngine::ReadPlainText(class CTxtRange *,struct _editstream *,int,class IUndoBuilder *,long) Unknown riched20.dll!CLightDTEngine::LoadFromEs(class CTxtRange *,long,struct _editstream *,int,class IUndoBuilder *) Unknown riched20.dll!CTxtEdit::TxSendMessage(unsigned int,unsigned __int64,__int64,__int64 *) Unknown riched20.dll!RichEditWndProc() Unknown riched20.dll!RichEditANSIWndProc() Unknown user32.dll!UserCallWinProcCheckWow() Unknown user32.dll!CallWindowProcAorW(__int64 ,struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,int) Unknown
it was a storage overlay I'll explain I had a global variable. the kept track of the number of records are but even so the exception didn't happen at that point. I ended doing a binary search from thousands of records. I had allocated 63 bytes assembler of storage. e,g a dc statement that defined 90 thing is the exception doesn't happen. right away its way down the road and you have no idea where those _crtcheckmemory don't really help.
-
it was a storage overlay I'll explain I had a global variable. the kept track of the number of records are but even so the exception didn't happen at that point. I ended doing a binary search from thousands of records. I had allocated 63 bytes assembler of storage. e,g a dc statement that defined 90 thing is the exception doesn't happen. right away its way down the road and you have no idea where those _crtcheckmemory don't really help.
ForNow wrote:
right away its way down the road
Yep that is how memory (heap) corruption works. You broke the heap at that point. Then somewhere after it something went to use the heap and at that point the data was bad. Additionally the behavior that happens could be almost anything. Depends on what the actual data (bad) was in the heap and what it was attempting to do with it at that point, and even what was calling it.
-
ForNow wrote:
right away its way down the road
Yep that is how memory (heap) corruption works. You broke the heap at that point. Then somewhere after it something went to use the heap and at that point the data was bad. Additionally the behavior that happens could be almost anything. Depends on what the actual data (bad) was in the heap and what it was attempting to do with it at that point, and even what was calling it.
When I overlay storage on z/os I get a s0c4 pic 10,11 etc my recovery gets control and I can pretty much determine what happened I had a record count at of x196e It actually happened at record x1905 had no idea where to look inserted crtmemory check at my new’s and map::insert Finally got it wondering if there is easier way to figure out storage/heap issues thank you