Click here to Skip to main content
15,888,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 0:41
Javier Luis Lopez17-Dec-15 0:41 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Jochen Arndt17-Dec-15 0:50
professionalJochen Arndt17-Dec-15 0:50 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 1:03
Javier Luis Lopez17-Dec-15 1:03 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Jochen Arndt17-Dec-15 1:20
professionalJochen Arndt17-Dec-15 1:20 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 1:26
Javier Luis Lopez17-Dec-15 1:26 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Jochen Arndt17-Dec-15 1:30
professionalJochen Arndt17-Dec-15 1:30 
PraiseRe: How to increase memory to avoid exception std::bad_alloc? Pin
jeron117-Dec-15 4:04
jeron117-Dec-15 4:04 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 22:03
Javier Luis Lopez17-Dec-15 22:03 
About using the task manager>process window, I found that there is an error of memory used varies about 4k from one run to the following, so it can be used to see memory variations in debug sessions taken in account that.

I used it to run the following very simple code:
#include <stdio.h>

void program_good()
{										//step #2
	char *memory=new char[10000L*1024L];
	memory[1024]=' ';					//step #3
	delete[] memory;
}										//step #4

void program_bad()
{
	char *memory=new char[10000L*1024L];
	memory[1024]=' ';//	step #6
}

void main()
{
	double x[10];

	char ptr0[1024];//  step #1
	program_good();
	char ptr1[1024];
	printf("\nMemory diference=%li",(long) (&ptr1-&ptr0-1024));
	program_bad();//	step #5
	char ptr2[1024];
	printf("\nMemory diference=%li",(long) (&ptr2-&ptr1-1024));


	printf("\n=== FIN ===");//step #6
	getchar();getchar();


In the task manager I found that my "Prueba.exe" memory usage was:

step #1 and #2: 484k
step #3: 10508k
step #4: 484k
step #5: 492k (I do not know why printf used 8kb)
step #6: 10516k

As result the calling of the program_bad() leaks 10Mb plus 32kb

So the task manager is not an exact tool but can help
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
jeron118-Dec-15 3:57
jeron118-Dec-15 3:57 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
CPallini17-Dec-15 21:46
mveCPallini17-Dec-15 21:46 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
David Crow17-Dec-15 2:43
David Crow17-Dec-15 2:43 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Chris Losinger17-Dec-15 4:46
professionalChris Losinger17-Dec-15 4:46 
AnswerRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 1:23
Javier Luis Lopez17-Dec-15 1:23 
QuestionSFTP in VS6 Pin
Schehaider_Aymen16-Dec-15 21:39
Schehaider_Aymen16-Dec-15 21:39 
QuestionHiding Registry Information From Readability in Assembler Pin
Lakshmi Dhivya15-Dec-15 20:24
Lakshmi Dhivya15-Dec-15 20:24 
AnswerRe: Hiding Registry Information From Readability in Assembler Pin
Daniel Pfeffer15-Dec-15 21:17
professionalDaniel Pfeffer15-Dec-15 21:17 
PraiseRe: Hiding Registry Information From Readability in Assembler Pin
David Crow16-Dec-15 2:07
David Crow16-Dec-15 2:07 
Questionhow to solve riccati equation differential in c++ or java Pin
Member 1220870815-Dec-15 2:15
Member 1220870815-Dec-15 2:15 
SuggestionRe: how to solve riccati equation differential in c++ or java Pin
Richard MacCutchan15-Dec-15 2:23
mveRichard MacCutchan15-Dec-15 2:23 
AnswerRe: how to solve riccati equation differential in c++ or java Pin
Daniel Pfeffer15-Dec-15 21:08
professionalDaniel Pfeffer15-Dec-15 21:08 
QuestionStrange compiler error Pin
ForNow14-Dec-15 6:14
ForNow14-Dec-15 6:14 
GeneralRe: Strange compiler error Pin
Richard MacCutchan14-Dec-15 6:50
mveRichard MacCutchan14-Dec-15 6:50 
GeneralRe: Strange compiler error Pin
ForNow14-Dec-15 6:58
ForNow14-Dec-15 6:58 
AnswerRe: Strange compiler error Pin
Jochen Arndt14-Dec-15 7:05
professionalJochen Arndt14-Dec-15 7:05 
QuestionProposal of a new C/C++ precompiler project Pin
Javier Luis Lopez13-Dec-15 23:52
Javier Luis Lopez13-Dec-15 23:52 

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.