Re: Out of Memory Problem in VB 6.0 Application.



"Mike Williams" <Mike@xxxxxxxxxxxxxxxxx> wrote in message
news:dgp6ph$39v$1@xxxxxxxxxxxxxxxxxxxxxxx
> I don't think so, Michael. Try this:
>
> Option Explicit
> Private Type test
> p1 As Long
> p2 As Long
> p3(1 To 500) As Double

Of course, that's a fixed size array. If you declare a dynamic array, as
Peri did, it will be a pointer. If you think about it, having a dynamic
array inline with the type would be impossible (or very difficult) becuase
the elements would not be evenly spaced in memory and higher elements would
need to be moved every time you resized the array.

> By the way, thanks for the info about VB arrays requiring a contiguous
> block of memory. I'm
> still a little confused about it though, because on my system I can create
> a massive array that
> requires much more real memory than I have on board and that can actually
> approach the total of
> real memory and swap file (on disk) memory. So can I take it that Windows
> memory management is
> able to treat a block of real RAM and a separate block of swap file (on
> disk) as one complete
> contiguous block, and that the CopyMemory API would do so also? Just
> wondering.

Just think of it as 2gigs of ram that you have at your disposal. It doesn't
matter if that's real ram or swap file it's still 2 gigs available to your
app. Windows and the cpu goes through some tricks to make your app think
it's got this one big continuous area of ram. To confuse matters more the 2
gigs won't map directly to the same addresses in ram, eg

addres 0 to 127 might be in a swap file
128 to 255 might be at 0x10000 in ram.

The problem you get is if you then allocate some small chunks of that 2 gigs
at, say, 1 meg spacing all the way through the 2 gig, then you wouldn't be
able to allocate anything bigger than 1 meg even though you've used up very
little space.

Michael


.



Relevant Pages

  • Re: Problem with M2N32 and 4x1GB RAM modules
    ... The IDENTICAL RAM modules that I bought when i ... Every time i sped through the windows boot process and got to ... was one game in particular that NEVER RAN properly with 4 gigs. ... Since the same 2 GB memory was really ...
    (alt.comp.periphs.mainboard.asus)
  • Re: Problem with M2N32 and 4x1GB RAM modules
    ... The IDENTICAL RAM modules that I bought when i built it ... Every time i sped through the windows boot process and got to the ... NEVER RAN properly with 4 gigs. ... Since the same 2 GB memory was really ...
    (alt.comp.periphs.mainboard.asus)
  • Re: Handling large amounts of data
    ... > stereo sound sample stored at 4bytes per sample, ... > array syntax. ... Writing the data to disk and then memory mapping the files ... of RAM, and 40MB is nothing. ...
    (comp.lang.c)
  • Re: Problem with M2N32 and 4x1GB RAM modules
    ... The IDENTICAL RAM modules that I bought when i ... Every time i sped through the windows boot process and got to ... was one game in particular that NEVER RAN properly with 4 gigs. ... Since the same 2 GB memory was really ...
    (alt.comp.periphs.mainboard.asus)
  • Re: " Sweet Spot" for XP SP3?
    ... John John wrote: ... This is news to me and may actually change my mind in adding more RAM. ... gigs is what most users report when 4 gigs is installed ... The memory requirements are quite confining as to type and amount of certain type banks etc. ...
    (microsoft.public.windowsxp.general)