Re: Out of Memory Problem in VB 6.0 Application.



"Peri" <Peri@xxxxxxxxxxxxxxxxx> wrote in message
news:%23JsUgvQvFHA.1560@xxxxxxxxxxxxxxxxxxxxxxx

> This is very difficult for me to change the code.
> Since all the arrays are dynamically allocated.
> Any other ideas ?

Others here have given you lots of ideas to look at, but something that
would give you an immediate benefit without any code changes would be to use
Singles instead of Doubles in your dblRAValue array (which is effectively
the "big eater" because there are so many of them). Obviously if you really
do need them to be doubles then there isn't much you can do without a fair
bit of work, but if Singles will suit your needs then you should be able to
forge on as you are. Can you change to Singles?

Alternatively, if you really do need Doubles then you can change the
dblRAValue to an array of Longs (or even Integers if you're not gonna go
over about 32K). Those Longs (or Integers) could then act merely as pointers
to a separate array of doubles. This would require more memory overall, but
it would require smaller contiguous blocks, with the major contiguous block
being only half or even a quarter of its original size.

Actually, I'm only guessing here that a VB array actually does require a
contiguous block of memory. Obviously it is much easier for the compiler to
deal with arrays if they are in a contiguous block, but there is no absolute
reason why it should be so. It would certainly be possible for Micro$haft to
have written the compiler such that it was capable of holding a large array
in a number of separate contiguous blocks, and internally "linking them
together" with a small array of pointers. Does anybody here know for certain
that VB arrays require a single contiguous block of memory?

Anyway, changing to Singles (or to Longs or Integers as pointers to Doubles)
is definitely worth looking at (unless you want to try using a number of
separate arrays and linking them together yourself, which might require some
work but which I imagine would be "do-able".

Mike



.



Relevant Pages

  • Re: operator overloading .. more
    ... > will be 25 ints in a contiguous block of memory. ... But inheriting matrix from array is simply wrong. ... > Whenever you use public inheritance, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: operator overloading .. more
    ... > will be 25 ints in a contiguous block of memory. ... But inheriting matrix from array is simply wrong. ... > Whenever you use public inheritance, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: memory management and containers
    ... but it has a contiguous block of memory filled by 'vector' ... > can't make an array grow. ... > certain amount of memory which can hold as much pointers as needed. ...
    (comp.lang.cpp)
  • Re: Out of Memory Problem in VB 6.0 Application.
    ... >deal with arrays if they are in a contiguous block, ... >have written the compiler such that it was capable of holding a large array ... >that VB arrays require a single contiguous block of memory? ... Interestingly ReDim Preserve an array down in size will not move the ...
    (microsoft.public.vb.general.discussion)
  • Re: MBF to IEEE (Beg. Q)
    ... The Sub DxToIEEEs works directly on MBF singles in place, ... a byte array is filled with data ...
    (microsoft.public.vb.general.discussion)

Loading