Re: Out of Memory Problem in VB 6.0 Application.
- From: "Michael D. Ober" <obermd.@.alum.mit.edu.nospam>
- Date: Tue, 20 Sep 2005 11:56:51 -0600
I believe OP's array was close to 1GB in size. In order to extend it with
redim, another 1GB must be found in the process's address space. Since
Windows defaults to a 2GB max process space, OP is simply running out of
memory in the process. OP can get to 1.5Gb by using the /3GB switch in the
boot.ini file, but this won't solve the problem - just delay it. The real
solution would be to redesign the program to either use collections of data
or smaller arrays.
Mike Ober.
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:7OSdnVASzKhktq3eRVn-1A@xxxxxxxxxxxxxxx
>
> "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx> wrote in message
> news:dgp6ph$39v$1@xxxxxxxxxxxxxxxxxxxxxxx
> > "Michael C" <nospam@xxxxxxxxxx> wrote in message
> news:O64mqrevFHA.612@xxxxxxxxxxxxxxxxxxxxxxx
> >
> > > I just realised the dblRAValue arrays will be pointers so will
> > > not make part of the contiguous block of memory.
> >
> > 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
> > End Type
> >
> > Private Sub Command1_Click()
> > Dim myvar As test
> > Print Len(myvar), LenB(myvar)
> > End Sub
> >
> > 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.
> >
> > Mike
> >
>
> It is useful to remember that we always walk on a certain amount of soft
> ground whenever you get into a discussion of memory in Windows as the VMM
> always lies beneath the surface. What we see 'mapped' into the
applications
> 'address space' may or may not be what is actually going on just below.
>
> Even the results of using "low-level" API calls can be illusionary - these
> calls talk to Win32 which itself is totally dependent on the whims and
> services of the VMM. You have remarkable control over what you would like
to
> 'see', but limited control, in practice, over what is really going on.
>
> Also while the VMM uses highly optimized 'memory routines', its general
> allocation scheme is based on 'best case' scenarios. Whenever its
> limitations are approached you either migrate to a C/C++ solution (where
you
> can invoke more control and optimizations) and the possible support of a
3rd
> party memory library, or you refractor and re-work your algorithm (thus
fit
> in better with its allocation scemes).
>
> -ralph
>
>
.
- 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
- Re: Out of Memory Problem in VB 6.0 Application.
- From: Ralph
- Out of Memory Problem in VB 6.0 Application.
- Prev by Date: open an existing dial-up connection from vb
- Next by Date: Re: Missing File Export Template in VB.NET
- 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
|