Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Powerbasic > Re: Strange Out...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 11 Topic 270 of 282
Post > Topic >>

Re: Strange Out of memory error.

by "Michael Mattias" <mmattias@[EMAIL PROTECTED] > Jun 18, 2008 at 02:07 PM

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
>
>
>
 




 11 Posts in Topic:
Strange Out of memory error.
"Luke" <luke  2008-06-18 20:38:42 
Re: Strange Out of memory error.
"Michael Mattias&quo  2008-06-18 14:07:37 
Re: Strange Out of memory error.
"Luke" <luke  2008-06-19 09:53:48 
Re: Strange Out of memory error.
"Michael Mattias&quo  2008-06-19 07:37:26 
Re: Strange Out of memory error.
Peter Manders <news@[E  2008-06-19 17:13:59 
Re: Strange Out of memory error.
bok118@[EMAIL PROTECTED]   2008-06-19 09:54:31 
Re: Strange Out of memory error.
"Luke" <luke  2008-06-19 13:29:22 
Re: Strange Out of memory error.
Wolfgang Enzinger <weu  2008-06-24 11:33:40 
Re: Strange Out of memory error.
"Luke" <luke  2008-06-27 11:38:15 
Re: Strange Out of memory error.
"Michael Mattias&quo  2008-06-27 07:00:19 
Re: Strange Out of memory error.
bok118@[EMAIL PROTECTED]   2008-07-28 14:29:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 18:19:21 CDT 2008.