De-allocating the whole array with ReDim() ???? 
Author Message
 De-allocating the whole array with ReDim() ????

Hi,

Suppose I have a procedure with,

Dim X() As Integer        'QUESTION 1 : No memory is allocated just yet, right ?????
   .
   .
ReDim X(5) As Integer     'Allocates for 6 elements
   .
   .
ReDim X(1) As Integer     'Allocates for 2 element
   .
   .
ReDim X(0) As Integer     'Allocates for 1 element

ReDim X(?????) As Integer   ' QUESTION 2 : How do I free up all the memory ?????

Thanks,
T. Roy



Mon, 29 Jun 1998 03:00:00 GMT  
 De-allocating the whole array with ReDim() ????

Quote:
>Suppose I have a procedure with,

>Dim X() As Integer        'QUESTION 1 : No memory is allocated just yet, right ?????

Wrong. VB has created an internal "handle" for the array.

Quote:
>   .
>   .
>ReDim X(5) As Integer     'Allocates for 6 elements

Unless you used an Option Base statement.

Quote:
>ReDim X(?????) As Integer   ' QUESTION 2 : How do I free up all the memory ?????

Erase X

Simple :)

-Andy Cook.



Mon, 29 Jun 1998 03:00:00 GMT  
 De-allocating the whole array with ReDim() ????


Quote:
>ReDim X(?????) As Integer   ' QUESTION 2 : How do I free up all the memory ?????

Erase X

Jens
--
* Everything I said are the opinions of someone else.   *
* I just cut-and-pasted.                                *

Jens Balchen jr.       http://www.sn.no/~balchen



Mon, 29 Jun 1998 03:00:00 GMT  
 De-allocating the whole array with ReDim() ????

Quote:

>Hi,

>Suppose I have a procedure with,

>Dim X() As Integer        'QUESTION 1 : No memory is allocated just yet, right
?????
>   .
>   .
>ReDim X(5) As Integer     'Allocates for 6 elements
>   .
>   .
>ReDim X(1) As Integer     'Allocates for 2 element
>   .
>   .
>ReDim X(0) As Integer     'Allocates for 1 element

>ReDim X(?????) As Integer   ' QUESTION 2 : How do I free up all the memory
?????

>Thanks,
>T. Roy

I think (can't be sure) I remember that the 'Erase' command reclaims memory
from arrays that you no longer need. Try searching in help for this.
                                                        Bill


Sat, 04 Jul 1998 03:00:00 GMT  
 De-allocating the whole array with ReDim() ????

Quote:

> Path:

> Hi,

> Suppose I have a procedure with,

> Dim X() As Integer        'QUESTION 1 : No memory is allocated just yet,
right ?????
>    .
>    .
> ReDim X(5) As Integer     'Allocates for 6 elements
>    .
>    .
> ReDim X(1) As Integer     'Allocates for 2 element
>    .
>    .
> ReDim X(0) As Integer     'Allocates for 1 element

> ReDim X(?????) As Integer   ' QUESTION 2 : How do I free up all the memory
?????

> Thanks,
> T. Roy

    Use :
    Erase X

Steve.



Mon, 06 Jul 1998 03:00:00 GMT  
 De-allocating the whole array with ReDim() ????

Quote:

> Hi,

> Suppose I have a procedure with,

> Dim X() As Integer        'QUESTION 1 : No memory is allocated just yet,
right ?????
>    .
>    .
> ReDim X(5) As Integer     'Allocates for 6 elements
>    .
>    .
> ReDim X(1) As Integer     'Allocates for 2 element
>    .
>    .
> ReDim X(0) As Integer     'Allocates for 1 element

> ReDim X(?????) As Integer   ' QUESTION 2 : How do I free up all the memory

?????

 Use - Erase X



Mon, 06 Jul 1998 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. dim and redim allocate memory?

2. How can I dynamically allocate and de-allocate memory from within VB5 ?

3. How to set free memory allocated by an array dynamically created

4. Allocating very BIG arrays

5. Dynamically allocated control arrays

6. Fixed length strings in a dynamically allocated array

7. surprised to get this error - Not enough room to allocate control array 'Pic

8. Dynamically allocated Global Type array

9. http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu

10. Mettre à jour une structure de table de base de donnée mdb par code

11. recuperar docemento de word de una base de datos

12. Como detectar el numero de serie (MAC) de una tarjeta de Red

 

 
Powered by phpBB® Forum Software