Click here to Skip to main content
15,791,891 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Font/FontSize Pin
C++NewBe14-Apr-08 5:21
C++NewBe14-Apr-08 5:21 
GeneralRe: Font/FontSize Pin
David Crow14-Apr-08 5:26
David Crow14-Apr-08 5:26 
GeneralQuery regarding ListBox Pin
Rahul Vaishnav14-Apr-08 3:29
Rahul Vaishnav14-Apr-08 3:29 
AnswerRe: Query regarding ListBox Pin
Rajesh R Subramanian14-Apr-08 3:36
professionalRajesh R Subramanian14-Apr-08 3:36 
GeneralRe: Query regarding ListBox Pin
Rajkumar R14-Apr-08 3:42
Rajkumar R14-Apr-08 3:42 
GeneralRe: Query regarding ListBox Pin
Rajesh R Subramanian14-Apr-08 3:46
professionalRajesh R Subramanian14-Apr-08 3:46 
GeneralRe: Query regarding ListBox Pin
Hamid_RT15-Apr-08 3:24
Hamid_RT15-Apr-08 3:24 
GeneralC++ new dynamic allocation of memory problem Pin
Member 336349814-Apr-08 3:28
Member 336349814-Apr-08 3: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 3:31
Cedric Moonen14-Apr-08 3:31 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Member 336349814-Apr-08 3:39
Member 336349814-Apr-08 3:39 
GeneralRe: C++ new dynamic allocation of memory problem [modified] Pin
JudyL_MD14-Apr-08 5:18
JudyL_MD14-Apr-08 5:18 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Matthew Faithfull14-Apr-08 3:57
Matthew Faithfull14-Apr-08 3:57 
AnswerRe: C++ new dynamic allocation of memory problem Pin
James R. Twine14-Apr-08 4:03
James R. Twine14-Apr-08 4:03 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Joe Woodbury14-Apr-08 7:57
professionalJoe Woodbury14-Apr-08 7:57 
GeneralRe: C++ new dynamic allocation of memory problem Pin
Stephen Hewitt14-Apr-08 16:27
Stephen Hewitt14-Apr-08 16:27 
QuestionSerial communication Pin
FPeeters14-Apr-08 2:05
FPeeters14-Apr-08 2:05 
GeneralRe: Serial communication Pin
Cedric Moonen14-Apr-08 2:16
Cedric Moonen14-Apr-08 2:16 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 2:38
FPeeters14-Apr-08 2:38 
QuestionRe: Serial communication Pin
CPallini14-Apr-08 3:11
mveCPallini14-Apr-08 3:11 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 3:18
FPeeters14-Apr-08 3:18 
GeneralRe: Serial communication Pin
Cedric Moonen14-Apr-08 3:22
Cedric Moonen14-Apr-08 3:22 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 3:33
FPeeters14-Apr-08 3:33 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 5:19
FPeeters14-Apr-08 5:19 
GeneralRe: Serial communication Pin
CPallini14-Apr-08 4:04
mveCPallini14-Apr-08 4:04 
GeneralRe: Serial communication Pin
FPeeters14-Apr-08 4:36
FPeeters14-Apr-08 4: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.