Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Memory allocation

Posted on 2004-10-12
6
285 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

839 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