Re: Out of Memory Problem in VB 6.0 Application.



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



.



Relevant Pages

  • memory leak in (?)... (redux)
    ... the mem leaks in our long-running tcl daemons. ... when actively exercised the app grows continuously. ... the mystery is that while our audit code does show us a couple of arrays ... and memory are checked and meanwhile externally, ...
    (comp.lang.tcl)
  • Re: StackOverflowException.
    ... The Status object monitors the ... so I'm really at a total loss as to where I'm leaking stack memory. ... private static extern bool EscapeCommFunction(IntPtr hFile, ... Good to know about arrays. ...
    (microsoft.public.dotnet.framework)
  • Re: Strategy for caches & GC
    ... I end up writing manual allocators for byte arrays. ... memory to insure it sits in the LOH and suballocate from there (ala ... ArraySlicehandle to work with buffers. ... and manual management for memory and GC generation 0 for efficient ...
    (microsoft.public.dotnet.framework.clr)
  • Re: perl eating up memory slowly until program stops - any ideas ?
    ... Arrays are created, variables are set, ... For lexical scoping, a single chunk of memory, reserved by ... Private blocks, you have discussed this a number of times ...
    (comp.lang.perl.misc)
  • Re: question about negative indices in fortran 77
    ... > Intel compilers for linux), but now I'm doing some modifications and I ... > subroutine where it isn't touched. ... out memory in the order arrays are declared. ...
    (comp.lang.fortran)