Re: Out of Memory Problem in VB 6.0 Application.
- From: "Michael C" <mculley@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 23 Sep 2005 11:30:49 +1000
"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
.
- Follow-Ups:
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Someone
- Re: Out of Memory Problem in VB 6.0 Application.
- References:
- Out of Memory Problem in VB 6.0 Application.
- From: Peri
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Peri
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Michael C
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Peri
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Mike Williams
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Peri
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Michael C
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Peri
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Mike Williams
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Mike Williams
- Out of Memory Problem in VB 6.0 Application.
- Prev by Date: Re: about mutiple databases [multiposted]
- Next by Date: Re: about mutiple databases
- Previous by thread: Re: Out of Memory Problem in VB 6.0 Application.
- Next by thread: Re: Out of Memory Problem in VB 6.0 Application.
- Index(es):
Relevant Pages
|