memory usage questions 
Author Message
 memory usage questions

I have one largish program that I fear will eat up memory. Does anyone know how
to explicitly free memory in VB 4.0a? Does anyone have a list of Stupid Code Tricks
to save memory? I am doing the obvious, conserving variables, setting all strings to "".
I am going to start load testing soon and would appreciate any help.



Mon, 07 Jun 1999 03:00:00 GMT
 memory usage questions

Hello,

Just a couple of things:

1)  Keep your variables local and your subs and functions small.  This
conserves memory because variable are de-allocated when they go out of
scope (accept STATIC variables of course).

2)  Use dynamic arrays rather than fixed length arrays, and make them
local.  This will keep you from allocating memory that never gets used.

3)  Set all object variables to Nothing when you are through with them.  
This is done like so:

        Dim db as Database
        Set db = DBEngine(0).OpenDatabase("c:\mydb.mdb")
        db.Execute "Delete * from tblFred;"

        ' here it is
        Set db = Nothing

This ensures that all resources and memory used to maintain the refrence to
the database (or any object for that matter) will be freed when the
variable goes out of scope.

4)  Avoid the use of global object variables.  See the #3 above.

5)  Use temporary tables in place of HUGE arrays.  Placing large amounts of
data in a table rather than an array can give you great advantages, not
just reduced memory usage.

Anyone else have some tips?  I hope I've helped,

Larry Tubbs, MCPS, MCSD
Silverleaf Vacation Club

http://www.flash.net/~enigma/


Quote:
> I have one largish program that I fear will eat up memory. Does anyone
know how
> to explicitly free memory in VB 4.0a? Does anyone have a list of Stupid
Code Tricks
> to save memory? I am doing the obvious, conserving variables, setting all
strings to "".
> I am going to start load testing soon and would appreciate any help.



Mon, 07 Jun 1999 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Sybase V5.0 Memory Usage Question

2. Memory usage question

3. SQL memory usage question

4. Memory Usage Question

5. Memory Usage question

6. Shared Virtual Memory Usage Question

7. ADO Causes 100% Memory Usage/Increases in VM Usage

8. Memory usage of dataserver question

9. A question on shared memory usage

10. WARNING: memory usage in procedure headers (1) does not match memory usage count in Pss (66) for server process id 63

11. SQL Server hogging up CPU usage / memory leaks

12. Same query, different servers, different client memory usage


 
Powered by phpBB® Forum Software