Solved

Memory allocation

Posted on 2004-10-12
6
282 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

743 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

12 Experts available now in Live!

Get 1:1 Help Now