[Gambas-user] what determines an application's resource useage

Ron Onstenk ronstk at ...239...
Fri Apr 25 10:37:08 CEST 2008


On Thursday 24 April 2008 22:14, Benoit Minisini wrote:
> On jeudi 24 avril 2008, M0E Lnx wrote:
> > This question has been going around in my head for quite a while and
> > I'd like to get an answer.
> >
> > How can I make sure that my application doesn't consume too much of
> > the system resources?
> > It is my understanding (correct me if I'm wrong) that if I assign a
> > variable in an application, the system will allocate a certain ammount
> > of RAM to that one variable (Ammount depends on the type of variable
> > that is declared)
> 
> No, assigning a variable does not use memory at all.
> 
> Memory is allocated when:
> 
> - A class is loaded.
> 
> - A new object is created.
> 
> The variables in the stack are allocated at startup.
> 
> And of course, the libraries used by Gambas allocates memory on their own.
> 
> Regards,
> 

uuum

Variables should use memory. but the difference here is the space is not
used in the runtime resident allocated memory space but the stack.

However do not put to much on that stack space. It is not size of your free
memory (1Gibyte Dram inserted) but a limitted memory stack space.
Creating dynamic 100000 variables/objects wil hurt that stack.

Stack is also memory so the answer in reality is 'yes' but a more
efficent way and the resident (fixed) menory footprint stays small.

Ron




More information about the User mailing list