Click here to Skip to main content
15,885,309 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to develop a code for deleting duplicate value of an array from right left? Pin
Member 1221414918-Dec-15 7:04
Member 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
David Crow20-Dec-15 7:40 
QuestionHow to increase memory to avoid exception std::bad_alloc? Pin
Javier Luis Lopez16-Dec-15 23:36
Javier Luis Lopez16-Dec-15 23:36 
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
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 
As can you see in the code I used delete[], I used also delete only and in release mode but the memory was not freed.
By using static allocation my program used 26MB only.

I tried this simple code and worked fine:

C++
#include <stdio.h>

void main()
{
	long i,size=((long)(1024L*1024L*50L/6L))*6;
	for (i=0;i<100;i++)
	{
		__int16 (*memory)[6]=new __int16[1024L*1024L*50L/6L][6];
		memory[1024L*1024L][5]=132;
		delete memory;
		printf("\nAllocated and deallocated %li MB",i*(size/1024L)*sizeof(__int16)/1024);
	}
	printf("\n=== FIN ===");
	getchar();getchar();
}


Perhaps the visual studio could not deallocate the memory to be reused because any operation reason
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 
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 

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.