[Gambas-user] About Gambas arrays

nando nando_f at ...951...
Tue May 3 16:17:12 CEST 2005


Thank you.

About item (2) below - what I meant was:

would...
  my_array [1234,12] = "HELLO"
  my_array [1234,12] = "Good Bye"

perform a re-malloc to lengthen the string space requirements
because line 2 is longer than line 1 ?

-Fernando


---------- Original Message -----------
From: Benoit Minisini <gambas at ...1...>
To: gambas-user at lists.sourceforge.net
Sent: Tue, 3 May 2005 10:19:33 +0200
Subject: [Gambas-user] About Gambas arrays

> 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...
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.
> Get your fingers limbered up and give it your best shot. 4 great 
> events, 4 opportunities to win big! Highest score wins.NEC IT Guy 
> Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list