NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: nobody on August 15, 2006, 03:57:05 PM
-
Hi to everybody,
I just would want to know how much is the maximum dimension for an array in Nasm, is it possible to declare an array of 500 Mega byte??
(I know I can theoretically address 4Gbyte, so I assume I can use them like I want....)
Thank you in advance,
Fabrizio
-
Hi Fabrizio,
Why don't you try it? Oh, you did. And it didn't work. Acted almost as if Nasm were buggy, you say? Hmmm.
I would have said, "Sure, no problem - your OS may not like it, but Nasm won't have a problem!" But that seems not to be the case...
I suppose we're interested in uninitialized data, but let's dispense with "times N db 0" first. For N=80000000h, Nasm reports a negative parameter to "times", one less gets Nasm unceremoniously "Killed". Seems to depend on total system memory, and on what else is running. Probably not Nasm's fault - see "man 2 malloc" about "Really Bad Bug".
In .bss, resb 80000000h ends in a "panic"(!). from 10000000h to 7FFFFFFFh gives a warning about "attempt to initialize data in a nobits section: ignored". Who was trying to initialize anything??? Despite the warning, Nasm seems to be doing the right thing. 0FFFFFFFh or less is fine.
So I guess you *can* allocate your 500 Megabytes, but Nasm will produce a bogus warning. Probably not something you *want* to do - unless you've got a ton of RAM, it would slow the system to a crawl, I would think...
That's pretty weird behavior! Thanks for bringing it to our attention!
Best,
Frank
-
Thank you Frank,
on the other side somebody told me there are also some API functions which can do this job,
so now I will check MSDN documentation for further help
Fabrizio