Click here to Skip to main content
14,661,075 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Why CButton-derived class with BS_GROUPBOX style doesn't get messages? Pin
Richard MacCutchan19-Dec-15 21:11
mveRichard MacCutchan19-Dec-15 21:11 
AnswerRe: Why CButton-derived class with BS_GROUPBOX style doesn't get messages? Pin
Yaumen19-Dec-15 21:28
MemberYaumen19-Dec-15 21:28 
AnswerRe: Why CButton-derived class with BS_GROUPBOX style doesn't get messages? Pin
Jochen Arndt20-Dec-15 0:13
professionalJochen Arndt20-Dec-15 0:13 
GeneralRe: Why CButton-derived class with BS_GROUPBOX style doesn't get messages? Pin
Yaumen20-Dec-15 7:41
MemberYaumen20-Dec-15 7:41 
Questionhow to develop a code for deleting duplicate value of an array from right left? Pin
Member 1221414918-Dec-15 7:04
MemberMember 1221414918-Dec-15 7:04 
SuggestionRe: how to develop a code for deleting duplicate value of an array from right left? Pin
Richard MacCutchan18-Dec-15 7:35
mveRichard MacCutchan18-Dec-15 7:35 
AnswerRe: how to develop a code for deleting duplicate value of an array from right left? Pin
David Crow20-Dec-15 7:40
MemberDavid Crow20-Dec-15 7:40 
QuestionHow to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez16-Dec-15 23:36
MemberJavier Luis Lopez16-Dec-15 23:36 
I made a image comparison program, but an exception error appeared at iteration number 1350, the code is here:

void compara_face(__int16 cara1[YMAX][XMAX],__int16 centro1[2*3],__int16 cara2[YMAX][XMAX],__int16 centro2[2*3],__int16 zoom_level,__int16 num_filtros,double error[2])
{
	error[0]=error[1]=1e199;//error en direccion x e y
	if (zoom_level >DMAX) 	{ 		printf("\nERROR en compara_face() zoom_level =%i > %i",zoom_level ,DMAX);return; 	}
	if (num_filtros>FMAX) 	{ 		printf("\nERROR en compara_face() num_filtros=%i > %i",num_filtros,FMAX);return; 	}
	double coef[6];//coeficiente de trasformada de 3 puntos
	trasformada3p_hallacoef(centro1,centro2,coef);
	__int16 (*filtro2)[6]=new __int16[num_filtros][6];
	__int16 (*filtro3)[6]=new __int16[num_filtros][6];  ERROR IS HERE!!!!
	__int16 d=DELTA[zoom_level],z=zoom_level;//delta de x e y
	long i;__int16 x1,y1;

	//direccion x FILTROX[DMAX][FMAX][2];
	transformada3P_dx(coef,FILTROX[z],filtro2,d,num_filtros);
	transformada3P_dy(coef,FILTROY[z],filtro3,d,num_filtros);
	error[0]=error[1]=0.0;//error en direccion x e y
	for (i=0;i<num_filtros;i++)
	{
		x1=FILTROX[z][i][0];y1=FILTROX[z][i][1];//Nota: filtro2[6]={ Tx(x,y),Ty(x,y),  Tx(x+d,y),Ty(x+d,y), Tx(x+2d,y),Ty(x+2d,y) } siendo Tx(x1,y1) la trasformada de (x1,y1) en el eje x
		error[0]+=fabs( (double)(
			(cara1[y1][x1  ]-cara1[y1][x1+  d])* (cara2[filtro2[i][3]][filtro2[i][2]] - cara2[filtro2[i][5]][filtro2[i][4]])-
			(cara1[y1][x1+d]-cara1[y1][x1+2*d])* (cara2[filtro2[i][1]][filtro2[i][0]] - cara2[filtro2[i][3]][filtro2[i][2]])  ));
		x1=FILTROY[z][i][0];y1=FILTROY[z][i][1];//Nota: filtro2[6]={ Tx(x,y),Ty(x,y),  Tx(x,y+d),Ty(x,y+d), Tx(x,y+2d),Ty(x,y+2d) } siendo Tx(x1,y1) la trasformada de (x1,y1) en el eje x
		error[1]+=fabs( (double)( 
			(cara1[y1  ][x1]-cara1[y1+  d][x1])* (cara2[filtro3[i][3]][filtro3[i][2]] - cara2[filtro3[i][5]][filtro3[i][4]])-
			(cara1[y1+d][x1]-cara1[y1+2*d][x1])* (cara2[filtro3[i][1]][filtro3[i][0]] - cara2[filtro3[i][3]][filtro3[i][2]])  ));
	}
	delete[] filtro2,filtro3;
}


The error appear in the second "new" command. The program uses a lot of RAM, perhaps I need to compiler or linker to use more ram or allocate memory as static instead dynamic.
The program uses about 2 gigabytes

modified 17-Dec-15 5:44am.

AnswerRe: How to increase memory to avoid exception std::bad_alloc? Pin
Jochen Arndt17-Dec-15 0:03
professionalJochen Arndt17-Dec-15 0:03 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 0:41
MemberJavier 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
MemberJavier 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
MemberJavier 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
Memberjeron117-Dec-15 4:04 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez17-Dec-15 22:03
MemberJavier Luis Lopez17-Dec-15 22:03 
GeneralRe: How to increase memory to avoid exception std::bad_alloc? Pin
jeron118-Dec-15 3:57
Memberjeron118-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
MemberDavid 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
MemberJavier Luis Lopez17-Dec-15 1:23 
QuestionSFTP in VS6 Pin
Schehaider_Aymen16-Dec-15 21:39
MemberSchehaider_Aymen16-Dec-15 21:39 
QuestionHiding Registry Information From Readability in Assembler Pin
Lakshmi Dhivya15-Dec-15 20:24
MemberLakshmi 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 

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.