Re: object deallocation

new topic     » goto parent     » topic index » view thread      » older message » newer message

snortboy writes:
> if i have object a = {{{3, "foo"}, 19.876},{4, "nice"},5, "rat", 9.7},
> and i wanted to completely "deallocate" all the assignments, so that i
> could change it's structure completely...like to say a = {4}, how could
> i do that?  or does it happen automatically?

Short answer: It happens automatically.

Long Answer: Euphoria uses a system of "reference counts"
on all sequences and floating-point (8-byte) atoms. When a sequence
or f.p. atom is no longer "pointed at" from anywhere,
Euphoria will notice that the reference count on that object is 0,
and the memory for the object will be immediately deallocated.
Integer atoms are only 4-bytes, so rather than storing a 4-byte
pointer to an integer, Euphoria will simply store a copy of the
integer itself, and avoid the need for reference counting.

One of the main strengths of Euphoria is that it keeps track
of storage allocation/deallocation for you. This frees you to
concentrate on your algorithm, without getting bogged down
in tedious low-level issues that cause a large percentage
of the bugs with other languages. I read somewhere
that at least 20% of the debugging time for C programs is
due to failures to allocate/deallocate memory properly.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu