Solved

Memory allocation

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

831 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