Solved

Memory allocation

Posted on 2004-10-12
6
287 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
[X]
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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PDF library for Delphi 2 149
is twain_32.dll cmpatible with windows 10 ? 10 276
c++, dynamic object by json 1 65
show out valin of json for debugging in visaul c++ 1 54
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 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 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.

751 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