swarm-hackers
[Top][All Lists]
Advanced

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

Re: [swarm-hackers] Conforming to <NSCopying>


From: Scott Christley
Subject: Re: [swarm-hackers] Conforming to <NSCopying>
Date: Mon, 16 Nov 2009 16:22:49 -0800


Swarm uses a specialized memory allocation scheme, so you should not use the -new method to create new Swarm objects.  Swarm has its own Zone structure different from NSZone, and the two are not compatible.

You could implement -copyWithZone: for Heatbug but you could not guarantee that the Heatbug was allocated in the Zone passed in as a parameter.

Scott

On Nov 14, 2009, at 6:50 PM, Nima Talebi wrote:

Hi, I'm trying to get my Heatbugs to conform to <NSCopying>...

#pragma mark NSCopying
- (id)copyWithZone:(NSZone *)zone {
    Heatbug *clone = [Heatbug new];
    [clone setWorld:[self world] Heat:[self heatSpace]];
    [clone createEnd];
    [clone autorelease];
    return clone;
}

However the Swarm framework gives me an error...


*** event raised for error: BlockedObjectAlloc
*** function: -[Object_s copy](), file: /Users/nima/devel/FWSwarm/swarm/macosx/SwarmOSX/../../src/defobj/DefObject.m, line: 793
> Requested operation is defined by the Object superclass of the GNU
> Objective C runtime system, but is blocked from usage because its default
> implementation is incompatible with the model of zone-based allocation
> established by the defobj package.  To allocate, free, or copy objects
> that use the defined model of zone-based allocation, one of the messages
> create:, createBegin:/End, drop, or copy: must be used instead.
*** execution terminating due to error
/Users/nima/devel/FWSwarm/swarm/macosx/SwarmOSX/../../src/defobj/Symbol.m:187 -[Error_c raiseEvent:]
Program received signal:  “SIGABRT”.


...That is probably a very good explanation for those who know what they're doing :)

Could someone iterate a little more on this for me?

_______________________________________________
swarm-hackers mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/swarm-hackers


reply via email to

[Prev in Thread] Current Thread [Next in Thread]