Click here to Skip to main content
15,897,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Font/FontSize Pin
C++NewBe14-Apr-08 4:21
C++NewBe14-Apr-08 4:21 
GeneralRe: Font/FontSize Pin
David Crow14-Apr-08 4:26
David Crow14-Apr-08 4:26 
GeneralQuery regarding ListBox Pin
Rahul Vaishnav14-Apr-08 2:29
Rahul Vaishnav14-Apr-08 2:29 
AnswerRe: Query regarding ListBox Pin
Rajesh R Subramanian14-Apr-08 2:36
professionalRajesh R Subramanian14-Apr-08 2:36 
GeneralRe: Query regarding ListBox Pin
Rajkumar R14-Apr-08 2:42
Rajkumar R14-Apr-08 2:42 
GeneralRe: Query regarding ListBox Pin
Rajesh R Subramanian14-Apr-08 2:46
professionalRajesh R Subramanian14-Apr-08 2:46 
GeneralRe: Query regarding ListBox Pin
Hamid_RT15-Apr-08 2:24
Hamid_RT15-Apr-08 2:24 
GeneralC++ new dynamic allocation of memory problem Pin
Member 336349814-Apr-08 2:28
Member 336349814-Apr-08 2:28 
Hi,using native C++ in dlls called from a VB.NET application I want to dynamically allocate up to 3 GB of memory, in stages, using the “new” command.

The following code (example to illustrate the problem) produces the following error “Unhandled exception at 0x7c81eb33 n VMTest.exe: Microsoft C++ exception:std::bad_alloc at memory location 0x0012fe10..”

I have configured the virtual memory under control panel|system properties|Advanced tab|Advanced tab|settings to “System managed size” and customised with Initial size = 756 and Maximum size = 8192 with no success. I am using VS2005 on XP SP2.

Please can anybody advise me on a way forward using the "new" command or an alternative.

#include "stdafx.h"
#include <iostream>;

using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
int count = 1000000000;

char buf;
char * cmemblock;
char unsigned * cumemblock;

cout << "Start of program" << endl;

cmemblock = new char [count];
cout << "cmemblock created" << endl;
cin >> buf;

cumemblock = new char unsigned [count];
cout << "cumemblock created" << endl;

cout << "Memory taken" << endl;

delete[] cmemblock;
cout << "cmemblock deleted" << endl;

delete[] cumemblock;
cout << "cmemblock deleted" << endl;

cout << "Successfull completion of program" << endl;

cin >> buf;

return 0;
}
GeneralRe: C++ new dynamic allocation of memory problem Pin
Cedric Moonen14-Apr-08 2:31
Cedric Moonen14-Apr-08 2:31 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Member 336349814-Apr-08 2:39
Member 336349814-Apr-08 2:39 
GeneralRe: C++ new dynamic allocation of memory problem [modified] Pin
JudyL_MD14-Apr-08 4:18
JudyL_MD14-Apr-08 4:18 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Matthew Faithfull14-Apr-08 2:57
Matthew Faithfull14-Apr-08 2:57 
AnswerRe: C++ new dynamic allocation of memory problem Pin
James R. Twine14-Apr-08 3:03
James R. Twine14-Apr-08 3:03 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Joe Woodbury14-Apr-08 6:57
professionalJoe Woodbury14-Apr-08 6:57 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Stephen Hewitt14-Apr-08 15:27
Stephen Hewitt14-Apr-08 15:27 
QuestionSerial communication Pin
FPeeters14-Apr-08 1:05
FPeeters14-Apr-08 1:05 
GeneralRe: Serial communication Pin
Cedric Moonen14-Apr-08 1:16
Cedric Moonen14-Apr-08 1:16 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 1:38
FPeeters14-Apr-08 1:38 
QuestionRe: Serial communication Pin
CPallini14-Apr-08 2:11
mveCPallini14-Apr-08 2:11 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 2:18
FPeeters14-Apr-08 2:18 
GeneralRe: Serial communication Pin
Cedric Moonen14-Apr-08 2:22
Cedric Moonen14-Apr-08 2:22 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 2:33
FPeeters14-Apr-08 2:33 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 4:19
FPeeters14-Apr-08 4:19 
GeneralRe: Serial communication Pin
CPallini14-Apr-08 3:04
mveCPallini14-Apr-08 3:04 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 3:36
FPeeters14-Apr-08 3:36 

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.