Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer19-Jul-17 20:16
leon de boer19-Jul-17 20:16 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
ForNow19-Jul-17 21:42
ForNow19-Jul-17 21:42 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer19-Jul-17 22:05
leon de boer19-Jul-17 22:05 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
ForNow20-Jul-17 6:43
ForNow20-Jul-17 6:43 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer20-Jul-17 17:29
leon de boer20-Jul-17 17:29 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
ForNow21-Jul-17 2:47
ForNow21-Jul-17 2:47 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer21-Jul-17 3:35
leon de boer21-Jul-17 3:35 
AnswerRe: Help with Heap Corruption "Critical error detected c0000374" Pin
Jochen Arndt19-Jul-17 21:36
professionalJochen Arndt19-Jul-17 21:36 
The heap corruption indicates that you have an out of bound memory write access (e.g. writing to an array beyond it's size). Running out of memory indicates that you are allocating a lot of memory but not freeing it.

For modeless dialogs follow these adviceses:

  • Create a variable and initialise it (assigning NULL or using new)
  • When the dialog should be created the first time check if the variable is NULL and call new if so
  • Create the dialog
  • When finished with the dialog, call DestroyWindow()
  • If the allocated memory is not needed anymore, delete it and assign NULL to the variable
  • When the variable goes out of scope, delete the memory (e.g. in the destructor of the class holding the variable)

I suggest to check your code for the above (each new must have a corresponding delete, and each CDialog::Create must have a corresponding CDialog::DestroyWindow).

Because the memory corruption is a severe error, I suggest to find the source and fix it first. Use a debug build. Then you don't need the GFlags. They are for debugging executable files where you don't have the sources.

If you know the code portions (or have a guess) where the heap corruption occurs, you can insert some AfxCheckMemory[^] calls to check the C++ heap.

Quote:
it is after do the create of the dialog and populate the control including allocating via new a Richedit and streaming data to it that something goes wrong all storage is allocated via new
A common error for such cases is forgetting to append a NULL char to the received data before passing them as string and/or forgetting to allocate the additional memory for the NULL char.
GeneralCards.dll Pin
Member 1171866719-Jul-17 1:40
Member 1171866719-Jul-17 1:40 
AnswerRe: Cards.dll Pin
Jochen Arndt19-Jul-17 3:29
professionalJochen Arndt19-Jul-17 3:29 
GeneralRe: Cards.dll Pin
Richard MacCutchan19-Jul-17 4:59
mveRichard MacCutchan19-Jul-17 4:59 
GeneralRe: Cards.dll Pin
leon de boer19-Jul-17 5:54
leon de boer19-Jul-17 5:54 
GeneralRe: Cards.dll Pin
Richard MacCutchan19-Jul-17 6:58
mveRichard MacCutchan19-Jul-17 6:58 
QuestionCompiler generated code Pin
ForNow13-Jul-17 14:43
ForNow13-Jul-17 14:43 
AnswerRe: Compiler generated code Pin
leon de boer13-Jul-17 16:43
leon de boer13-Jul-17 16:43 
GeneralRe: Compiler generated code Pin
jschell15-Jul-17 7:34
jschell15-Jul-17 7:34 
AnswerRe: Compiler generated code Pin
Peter_in_278013-Jul-17 16:44
professionalPeter_in_278013-Jul-17 16:44 
QuestionInterprocess communication in C without pipes or disk Pin
Chris Maunder12-Jul-17 13:14
cofounderChris Maunder12-Jul-17 13:14 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Espen Harlinn12-Jul-17 14:03
professionalEspen Harlinn12-Jul-17 14:03 
GeneralRe: Interprocess communication in C without pipes or disk Pin
leon de boer12-Jul-17 18:49
leon de boer12-Jul-17 18:49 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Randor 13-Jul-17 14:08
professional Randor 13-Jul-17 14:08 
GeneralRe: Interprocess communication in C without pipes or disk Pin
Chris Maunder19-Jul-17 6:01
cofounderChris Maunder19-Jul-17 6:01 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Joe Woodbury17-Jul-17 10:53
professionalJoe Woodbury17-Jul-17 10:53 
Questionwhich one would be better? Pin
bestbear11-Jul-17 1:51
bestbear11-Jul-17 1:51 
AnswerRe: which one would be better? Pin
Jochen Arndt11-Jul-17 3:41
professionalJochen Arndt11-Jul-17 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.