Solved

Memory allocation

Posted on 2004-10-12
6
283 Views
Last Modified: 2010-04-01
Please I am trying to allocate the memory and I have this compilation error :

Memory allocation failure (536870921 items of size 8 bytes)
Allocated memory before this call: -2147481980 bytes

How could I do to solve this memory allocation problem ?
Thnaks youi
0
Comment
Question by:bertinoflex
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
rstaveley earned 25 total points
ID: 12285582
You've attempted to allocate just over 4G. A 32-bit memory pointer can only address 2^32 = 4.2 billion locations (i.e. 4GB).
0
 
LVL 17

Expert Comment

by:rstaveley
ID: 12285603
The solution for your problem depends on your application. Why do you need such a large allocation?
0
 
LVL 3

Assisted Solution

by:aravindtj
aravindtj earned 25 total points
ID: 12300338
Hi,
 check variable that sets the size.
 check whether that is initialized properly.
 the same thing occured to me also.
 Betterway to use size_t as a data type insteed of bare int 's.

 Even though compilers allows such a large allocation, you system may hang up.

All the best.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now