Re: Memory allocation problem

2009-08-11 Thread language_fan
Tue, 11 Aug 2009 12:58:59 +, language_fan thusly wrote: > I even think that if your OS supports page > files, it doesn't matter if the memory is on chip or disk - if the > memory is split 3/1 for processes and kernel, you should be able to > allocate 2 GB easily. For example my system has 5GB

Re: Memory allocation problem

2009-08-11 Thread language_fan
Mon, 10 Aug 2009 14:15:41 -0400, bearophile thusly wrote: > Steven Schveighoffer: >> My point is, don't count on having 2GB of usable space even if you >> physically have 2GB of RAM, it may not be the case. > > I was looking for using 1.8 GB not 2. > > >>Better off to not desire than to complai

Re: Memory allocation problem

2009-08-10 Thread BCS
Reply to Steven, On Sun, 09 Aug 2009 15:51:46 -0400, bearophile wrote: grauzone: Then what is there to complain?< I have paid for 2 GB RAM, so I am allowed to desire a 1800 MB array :-) hehe. Not necessarily. There are often hardware/OS limitations. For example, many 32-bit Intel c

Re: Memory allocation problem

2009-08-10 Thread bearophile
Jeremie Pelletier: >I can't even think of an use for such large arrays. There is always a way to >split the allocation in smaller ones which will be easy to map in the >available virtual memory space.< You not being able to imagine a good use case doesn't imply there isn't one :-) This program

Re: Memory allocation problem

2009-08-10 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 http://www.digitalmars.com/d/archives/digitalmars/D/OPTLINK_and_LARGEADDRESSAWARE_88061.html bearophile wrote: > In a small program on Windows XP I have to allocate a large chunk of RAM, > about 1847 MB of RAM. This PC has 2 GB RAM. So I use std.c.st

Re: Memory allocation problem

2009-08-10 Thread Jeremie Pelletier
bearophile Wrote: > Robert Fraser: > > I agree it's a bug, and probably a rather major one. However in a real > > use case, any program that needs 1800+ MB arrays should be 64-bit only. > > In that program there's essentially just that large array. > What is the size of biggest array you suggest

Re: Memory allocation problem

2009-08-10 Thread Steven Schveighoffer
On Mon, 10 Aug 2009 14:15:41 -0400, bearophile wrote: Steven Schveighoffer: My point is, don't count on having 2GB of usable space even if you physically have 2GB of RAM, it may not be the case. I was looking for using 1.8 GB not 2. Better off to not desire than to complain about edge co

Re: Memory allocation problem

2009-08-10 Thread bearophile
Steven Schveighoffer: > My point is, don't count on having 2GB of usable space even if you > physically have 2GB of RAM, it may not be the case. I was looking for using 1.8 GB not 2. >Better off to not desire than to complain about edge conditions based on >hardware limitations.< With C I ca

Re: Memory allocation problem

2009-08-10 Thread Steven Schveighoffer
On Sun, 09 Aug 2009 15:51:46 -0400, bearophile wrote: grauzone: Then what is there to complain?< I have paid for 2 GB RAM, so I am allowed to desire a 1800 MB array :-) hehe. Not necessarily. There are often hardware/OS limitations. For example, many 32-bit Intel chipsets support 4G

Re: Memory allocation problem

2009-08-10 Thread bearophile
Robert Fraser: > I agree it's a bug, and probably a rather major one. However in a real > use case, any program that needs 1800+ MB arrays should be 64-bit only. In that program there's essentially just that large array. What is the size of biggest array you suggest to use in a D/C program on a 3

Re: Memory allocation problem

2009-08-10 Thread Robert Fraser
bearophile wrote: grauzone: Then what is there to complain?< I have paid for 2 GB RAM, so I am allowed to desire a 1800 MB array :-) I agree it's a bug, and probably a rather major one. However in a real use case, any program that needs 1800+ MB arrays should be 64-bit only.

Re: Memory allocation problem

2009-08-09 Thread bearophile
grauzone: >Then what is there to complain?< I have paid for 2 GB RAM, so I am allowed to desire a 1800 MB array :-) >You know you must check return values.< In real programs I check the return value of malloc, of course. >The D allocation probably fails due to memory fragmentation (just a gue

Re: Memory allocation problem

2009-08-09 Thread grauzone
bearophile wrote: Frank Benoit: Is it the malloc that fails (returning null) or the handling of the block?< It's the filling of the memory block. malloc by itself doesn't crash. Then what is there to complain? You know you must check return values. The D allocation probably fails due to mem

Re: Memory allocation problem

2009-08-09 Thread bearophile
Frank Benoit: >Is it the malloc that fails (returning null) or the handling of the block?< It's the filling of the memory block. malloc by itself doesn't crash. - Robert Fraser: > Have you tried with DMC?< I have done a test with MDC too now. // D code import std.c.stdlib:

Re: Memory allocation problem

2009-08-09 Thread Robert Fraser
bearophile wrote: I don't think so, I am running a 32 bit GCC on a 32 bit XP operating system. I think the bug is elsewhere (in DMD). Have you tried with DMC?

Re: Memory allocation problem

2009-08-09 Thread bearophile
Frank Benoit: >Is it the malloc that fails (returning null) or the handling of the block?< The malloc, as I have written. But only when used by DMD. Jeremie Pelletier: > Your C program probably compiled in 64bit, which has MUCH more room for > virtual memory. I don't thi

Re: Memory allocation problem

2009-08-09 Thread Frank Benoit
bearophile schrieb: > In a small program on Windows XP I have to allocate a large chunk of > RAM, about 1847 MB of RAM. This PC has 2 GB RAM. So I use > std.c.stdio.malloc(), with DMD v1.042 (or v2.031). But it's not able > to allocate it, and produces at runtime: Error: Access Violation > > An eq

Re: Memory allocation problem

2009-08-08 Thread Jeremie Pelletier
bearophile Wrote: > In a small program on Windows XP I have to allocate a large chunk of RAM, > about 1847 MB of RAM. This PC has 2 GB RAM. So I use std.c.stdio.malloc(), > with DMD v1.042 (or v2.031). But it's not able to allocate it, and produces > at runtime: > Error: Access Violation > > A

Memory allocation problem

2009-08-08 Thread bearophile
In a small program on Windows XP I have to allocate a large chunk of RAM, about 1847 MB of RAM. This PC has 2 GB RAM. So I use std.c.stdio.malloc(), with DMD v1.042 (or v2.031). But it's not able to allocate it, and produces at runtime: Error: Access Violation An equal program written in C and c