Hi everyone:
I'm new to this forum, so bear with me.
I have a question about memory utilization by arrays. My concern is that I don't think ScriptBasic releases memory consumed by an array back to the operating system when the array is destroyed.
I am writing an application that queries a MySQL database and stores the query results in an array. Logically, once I've done what I need to do with the query results, I want to destroy the array and free the memory back up to the OS.
As a test, I wrote a program that creates a huge two dimensional array (2 columns, 10,000 rows) full of garbage text. I set the program such that when it starts it first waits for an input from the user--just as a pause before it goes ahead and builds the array. Once the array is built, I wait for another input from the user and then destroy it using UNDEF.
When I run the program I start Task Manager and monitor memory consumption. When the program first start, 1004K is eaten up. No problem. I hit the enter key to get past the first input statement and build the junk array. The array is built, and memory consumption shoots up to somewhere around 8024K. Still everything going as expected. Then I hit the enter key again to destroy the array, but memory utilization does not drop! If anything, it increases a bit! Yet PRINTing one of the junk array's elements proves that the array is now undefined.
So the values stored in the array become undefined, but the memory that was reserved to initially create the array is never released.
Anybody got any thoughts on this and how I might be able to overcome it?
Thanks,
Norm