Strangely enough, the error message is exactly correct: you are trying to
allocate too much memory. Your available physical must now be such that
the
total requirements for your program when you try to allocate all of that
'available physical' exceed your 2 Gb user limit per process. That
limit
includes any space required for other things in your program.. eg, your
code, your stack, progam overhead, etc.
To execute that REDIM you need #elements * %MAX_PATH bytes VIRTUAL memory
available.
Your max remaining space in your process is the dwAvailVirtual member.But
I
would not bet a lot on the ability actually allocate that much. I could
never get more than 1.5 Gb (virtual) on my machine.
Just out of curiosity, why do you even bother trying to allocate that many
elements of that size? It's gonna get swapped out anyway.. and you can get
the benefit of the page files with memory-mapped file object without the
cost of not having any memory left for other things.
Not to mention, "physical" memory doesn't really mean much under Windows,
where everything is virtual.
--
Michael C. Mattias
Tal Systems Inc.
Racine WI
mmattias@[EMAIL PROTECTED]
"Luke" <luke987_1@[EMAIL PROTECTED]
> wrote in message
news:0Dc6k.5884$lU5.1953@[EMAIL PROTECTED]
> Hi,
>
> Below is shown a simplified version of a construct I have been used for
> years without any problem, but now it produce an error 7(Out of memory).
> What's new lately is that I have upgraded my memory from 1 to 2GB, and
> upgraded Windows XP from SP2 to SP3.
> Have anyone experienced memory problem with WinXP SP3?
> I tried making the array global, but that didn't make any difference.
> --
>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> #COMPILER PBCC 4.04
> #COMPILE EXE
> #DIM ALL
> $INCLUDE "Win32API.inc"
>
'----------------------------------------------------------------------------------
> FUNCTION PBMAIN () AS LONG
> LOCAL Elements AS DWORD,ms AS MEMORYSTATUS
> TRY
> ms.dwLength = SIZEOF(MEMORYSTATUS)
> GlobalMemoryStatus ms
> Elements = ms.dwAvailPhys/%MAX_PATH
> DIM myArray(1 TO Elements) AS LOCAL ASCIIZ * %MAX_PATH
> CATCH
> ? "Error: " + FORMAT$(ERR)
> END TRY
> ? "Availablememory: " + FORMAT$(ms.dwAvailPhys,"#,") + " bytes"
> ? "Elements: " + FORMAT$(Elements,"#,")
> ? "Press a key..."
> WAITKEY$
> END FUNCTION
>
>
>


|