Hi to everybody,
I just would want to know how much is the maximum dimension for an array in Masm32, 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
Fabrizio,
It is dictated by the OS, not the language but if you have enough memory you can allocate up to 2 gig using the system API calls. MASM handles these fine. I sometimes test procedures on 1 gig VOB files loaded directly into memory so it no big deal to do if the machine has enough memory.
Hutch,
Thank you for the replay, I'll go to MSDN to see which API function I can use :boohoo:
Best regards, Fabrizio
Sometimes when people refer to 'arrays' they mean for it to be allocated as a local variable. (Not that I'm saying you are, but just in case :wink)
'Allocating' large variables on the stack is not usually a good idea. In your case, using GlobalAlloc or HeapAlloc is fine for blocks of memory well over 500MB :U
(Though in certain cases HeapAlloc is limited to just under 512MB.. so maybe GlobalAlloc is preferable.)
Thank you Tedd,
I can save much time with your suggestions, now I must just have to test the suggestions, I will inform you about the result ::)
For large arrays, it's best to use VirtualAlloc. Will work well on every Win OS.