[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] garbage



That sounds interesting as well... I'll have some time later today to see if it is possible to store the uniqueMethods inside the class that is using them as well.

What I can't immediately figure out though is how an Object knows to look for a uniqueMethod at all... I can't seem to find where an object even looks at the Object:uniqueMethod array... I'll dig.

Josh

On Feb 28, 2008, at 1:06 AM, Ryan Brown wrote:

One solution would be to create a new subclass of Object named
something like DynamicObject that has an instance variable containing
a dictionary of Functions. You subclass DynamicObject rather than
Object if you want to add and remove methods. doesNotUnderstand can be
implemented for this class in sclang very quickly for Josh's needs. If
others like this solution we can modify doesNotUnderstand in C to look
at this specific instance var. for DynamicObject subclasses (which
will speed things up).

Adding this instance variable to Object isn't possible because it will
screw up arrays and hard-coded references to slots in primitives.
Adding a hash table to PyrObject isn't possible because the functions
won't be GC'd.

Ryan

On Feb 27, 2008, at 9:58 PM, Josh Parmenter wrote:

Any suggestions though about how to do this? For instance, if I set a
= nil, How does the original 'a' know it can clear it's unique methods
and be GC'd? My guess is that currently it can't, but I thought I
would check.

Or - is there a way to store unique methods within the object that is
created itself instead of in Object.uniqueMethods?

Best,

Josh

On Feb 27, 2008, at 7:36 PM, James McCartney wrote:

a.removeUniqueMethods will release an object from the table.
you can wipe out all unique methods by doing:
uniqueMethods = nil;

There is no finalization (dtor).


On Wed, Feb 27, 2008 at 4:40 PM, Josh Parmenter <josh@xxxxxxxxxxxxxxxxx
wrote:
Hi all,

Ryan Brown just pointed out to me that Objects that use
addUniqueMethod
don't get completely garbage collected (and this can be seen in
Object.uniqueMethods). Here is a short example:


a = Object.new.addUniqueMethod(\freeMe, {2});

Object.uniqueMethods;

a.freeMe

a = nil;

Object.uniqueMethods;






Is there anything already built into the language, like a dtor
function or
method that I could assign to an object that would remove unique
methods
from from this Object array?




Thanks...




Josh




******************************************

/* Joshua D. Parmenter

http://www.realizedsound.net/josh/




"Every composer – at all times and in all cases – gives his own
interpretation of how modern society is structured: whether
actively or
passively, consciously or unconsciously, he makes choices in this
regard. He
may be conservative or he may subject himself to continual renewal;
or he
may strive for a revolutionary, historical or social palingenesis."
- Luigi
Nono*/

_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel





--
--- james mccartney
_______

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

“Every composer – at all times and in all cases – gives his own
interpretation of how modern society is structured: whether actively
or passively, consciously or unconsciously, he makes choices in this
regard. He may be conservative or he may subject himself to continual
renewal; or he may strive for a revolutionary, historical or social
palingenesis." - Luigi Nono
*/

_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel


_______________________________________________
Sc-devel mailing list
Sc-devel@xxxxxxxxxxxxxxx
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel

******************************************
/* Joshua D. Parmenter
http://www.realizedsound.net/josh/

“Every composer – at all times and in all cases – gives his own interpretation of how modern society is structured: whether actively or passively, consciously or unconsciously, he makes choices in this regard. He may be conservative or he may subject himself to continual renewal; or he may strive for a revolutionary, historical or social palingenesis." - Luigi Nono
*/