[Gambas-user] About Gambas arrays
Benoit Minisini
gambas at ...1...
Tue May 3 10:19:33 CEST 2005
On Monday 02 May 2005 16:33, nando wrote:
> Benoit,
>
> Questions:
> (1) Does the following...
>
> PRIVATE my_array [4096, 16] as STRING
>
> ...occupy a static section of RAM or
> is it dymanic depending on the size of string actually stored
> in each element ?? (Remalloc'd every time there is an assignment?)
The array itself is statically allocated in your class, but a string is just a
pointer to a malloc() allocation.
By doing this, an object of your class will take at least 4096 * 16 * 4 = 256
Kb !
>
> (2) Are byte,integer arrays MALLOC'd in a static section of RAM once??
>
What do you mean by being "malloc'd" in a static section of ram once ???
There are two types of arrays in Gambas:
- "static arrays", declared with DIM array[x, y] AS Type
- "dynamic arrays", declared with DIM array AS NEW Type[x, y]
The dynamic arrays are true Gambas objects, like in Java, but not static ones.
Static arrays are allocated directly in the object they are declared (or in a
temporary allocation if you declared them as local variables in a method).
> Thanks
> -Fernando
>
>
Regardsn
--
Benoit Minisini
mailto:gambas at ...1...
More information about the User
mailing list