Re: Memory management limitations Win x Linux
- From: "Daniël Mantione" <daniel.mantione@xxxxxxxxxxxxxx>
- Date: 6 Jun 2007 13:30:15 -0700
=?ISO-8859-1?Q?Cl=E9ment_Doss?= <cdoss@xxxxxxxxxx> wrote:
Hi,
A friend of mine wrote a C++ program, and he has a problem.
This program depends on an algorithm he wrote that will allocate a lot of memory in
order to do some heavy calculations and produce some numbers.
He is using a linux and a native c++ compiler.
The fact is he need "a little more info" for his algorithm to be more effective, and
when he sets Ip=12000 and I=12000 (would be close to ideal), there's a bad_alloc
error. From what I can see, there's a 12000 * 12000 * 8 = 1.152.000.000 bytes and
12000 * 12000 * 8 * 3 = 3.456.000.000. What's 4.5Gb of ram of data for a 500 lines
C++ program? :-)
Is he taking the right approach if he needs such large arrays?
He asked me to convert the program to delphi and make some tests, but with the
figures above, I really couldn't give him any hope.
Simple. Compile the program with Free Pascal for x86_64. This
should make it work.
I downloaded turbo c++ explorer, and tried to compiled it. I ran the program but the
error is still there. With some nice hints by the way!! (Windows XP 2.5 Gb Ram)
As the memory grows, shouldn't some virtual memory kick in under windows? and under
linux?
No, you reach the limits of a 32-bit address space. A 64-bit
address space is required for such code to run. Virtual memory
only helps against lack of physical memory.
Anyway I wouldn't expect him to have such a problem (memory limitation) under linux.
You would, 32-bit Linux suffers from 32-bit limitations too.
I told him to change the "double" (64-bit) for "float" (32-bit) to see if that
affects the calculations. He is checking this write now. Ok this would cut in half
the memory consumption.
Is there any setting in the environment (or command line option, switch, flag) he can
make in order to compile and run such a memory consuming beast?
64-bit is the only solution. Well, or a better algorithm.
Daniël Mantione
.
- Follow-Ups:
- References:
- Memory management limitations Win x Linux
- From: Clément Doss
- Memory management limitations Win x Linux
- Prev by Date: Re: Top 3 VCL Request
- Next by Date: Re: Top 3 VCL Request
- Previous by thread: Re: Memory management limitations Win x Linux
- Next by thread: Re: Memory management limitations Win x Linux
- Index(es):
Relevant Pages
|
|