Dim memory usage

JamesC

Member
Licensed User
I'm using some potentially quite large arrays in my database program. How much memory is allocated from RAM when you dim an array? How does it differ for different datatypes? Can one free up RAM by using dim arrayname(0)?

Thanks.

The support on this forum is fantastic!! :sign0098:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
How large are your arrays?
If you don't specify any type for your array it will be a default strings array.
Such array is actually an array of pointers and the memory it uses will increase as you insert new items to the array.
It is better to declare large arrays that only suppose to hold numeric values as Double.

Dim arrayname(0) will free the RAM that this array holds (though not immediately).
 

JamesC

Member
Licensed User
Ta

Thanks Erel. The arrays were potentially a few hundred thousand records in size. The idea was to extract info from a (very large) text file (the chess .pgn file!), store it in arrays, and then insert it into an SQLite table. But I see now that I can insert the info at the same time as I read the info, one record at a time, or insert it every 1000 records, say.

James
 
Top