Hey,

I am working on a networking system that uses distributed objects. This is a
large collaboration between students, and I thought garbage collection would
be perfect for new Cocoa programmers, so we wouldn't have to deal with
memory management quite yet. The network will be a mix of Intel and PPC, so
there is another complication too.

Everything seems to work on Intel, it is on PPC that we have the problems.
When we first make the connection to the server, we can message the remote
object just fine. It is when we try to message the distant object at later
times that we get errors. This sounds enough like a memory management
problem. Sure enough, when turn off garbage collection, and add in the
proper retain calls, it seems to function fine. Does distributed objects
work with garbage collection (on PPC)? Here are some of the errors I am
getting.

Console output:

2008-12-13 11:42:02.204 StationTerminal[715:10b] *** -[NSAutoreleasePool
objectForKey:]: unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.222 StationTerminal[715:10b] Exception name:
NSInvalidArgumentException Reason: *** -[NSAutoreleasePool objectForKey:]:
unrecognized selector sent to instance 0x10610c0
2008-12-13 11:42:02.225 StationTerminal[715:10b] *** -[NSLock lock]:
deadlock (<NSLock: 0x1061040> '(null)')
2008-12-13 11:42:02.227 StationTerminal[715:10b] *** Break on _NSLockError()
to debug.

Note here, that NSAutoreleasePool is getting objectForKey:, as if it were a
dictionary. It is not always NSAutoreleasePool getting the message, we have
also got NSCFDataType and some internal color-related class receiving this
message, among others. Sound enough like a memory mangement issue?

Here is the call stack when that error is thrown. (the last call that is in
my program is #18, resetSubscriptions)

#0  0xffff8260 in ?? ()
#1  0x96a7fb94 in CFSocketCreateRunLoopSource ()
#2  0x91c1ef90 in __NSAddSocketToLoopForMode ()
#3  0x96a4a314 in CFDictionaryApplyFunction ()
#4  0x91c1fdcc in -[NSSocketPort scheduleInRunLoop:forMode:] ()
#5  0x91aed0c4 in +[NSRunLoop(NSRunLoop) _runLoop:addPort:forMode:] ()
#6  0x91c1f084 in -[NSSocketPort addConnection:toRunLoop:forMode:] ()
#7  0x91aecc64 in -[NSConnection addPortsToRunLoop:] ()
#8  0x91b0ae3c in -[NSConnection _incrementLocalProxyCount] ()
#9  0x91b0c678 in lookUpOrCreateLocalProxyForObject ()
#10 0x91b07128 in -[NSConcretePortCoder encodeObject:isBycopy:isByref:] ()
#11 0x91b06910 in _NSWalkData2 ()
#12 0x91b07974 in -[NSConcretePortCoder encodeInvocation:] ()
#13 0x91b07370 in -[NSConcretePortCoder encodeObject:isBycopy:isByref:] ()
#14 0x91b06910 in _NSWalkData2 ()
#15 0x91b057bc in -[NSConnection sendInvocation:internal:] ()
#16 0x96aea71c in ___forwarding___ ()
#17 0x96aea838 in __forwarding_prep_0___ ()
#18 0x00002afc in -[SCPushDatabaseClient resetSubscriptions]
(self=0x1029d70, _cmd=0x9bcc) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:88
#19 0x00003438 in -[SCPushDatabaseClient setSimulator:] (self=0x1029d70,
_cmd=0x9c1c, simulatorName=0x1020310) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:157
#20 0x91b445d8 in _NSSetObjectValueAndNotify ()
#21 0x91af2f88 in -[NSObject(NSKeyValueCoding) setValue:forKey:] ()
#22 0x91b65768 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#23 0x00002588 in -[SCPushDatabaseClient
setValue:forKeyPath:sentFromServer:] (self=0x1029d70, _cmd=0x9b80,
value=0x1020310, keyPath=0x106c0c0, fromServer=0 '\000') at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:64
#24 0x000023b8 in -[SCPushDatabaseClient setValue:forKeyPath:]
(self=0x1029d70, _cmd=0x91f99e38, value=0x1020310, keyPath=0x106c0c0) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCPushDatabaseClient.m:47
#25 0x91b65734 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#26 0x91b65734 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] ()
#27 0x94feda4c in -[NSBinder
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
()
#28 0x94fed81c in -[NSBinder setValue:forBinding:error:] ()
#29 0x94fed4d4 in -[NSValueBinder
_applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
()
#30 0x94fed134 in -[NSValueBinder
applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
()
#31 0x94fecdcc in -[NSValueBinder performAction:] ()
#32 0x94fecca8 in -[_NSBindingAdaptor
_objectDidTriggerAction:bindingAdaptor:] ()
#33 0x94e4fff0 in -[NSControl sendAction:to:] ()
#34 0x94e500e0 in -[NSApplication sendAction:to:from:] ()
#35 0x94eeb8a8 in -[NSMenu performActionForItemAtIndex:] ()
#36 0x94eeb5d8 in -[NSCarbonMenuImpl
performActionWithHighlightingForItemAtIndex:] ()
#37 0x94eccd90 in AppKitMenuEventHandler ()
#38 0x901ed3cc in DispatchEventToHandlers ()
#39 0x901ec564 in SendEventToEventTargetInternal ()
#40 0x90209464 in SendEventToEventTarget ()
#41 0x9023ef00 in SendHICommandEvent ()
#42 0x9026584c in SendMenuItemSelectedEvent ()
#43 0x90265750 in FinishMenuSelection ()
#44 0x902b7a48 in PopUpMenuSelectCore ()
#45 0x902b741c in _HandlePopUpMenuSelection7 ()
#46 0x94fa2344 in _NSPopUpCarbonMenu3 ()
#47 0x94fd668c in -[NSCarbonMenuImpl
popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:]
()
#48 0x94fd5a7c in -[NSPopUpButtonCell
trackMouse:inRect:ofView:untilMouseUp:] ()
#49 0x94e4e7a0 in -[NSControl mouseDown:] ()
#50 0x94e4d064 in -[NSWindow sendEvent:] ()
#51 0x94e20408 in -[NSApplication sendEvent:] ()
#52 0x94f97450 in -[NSApplication _realDoModalLoop:peek:] ()
#53 0x94f92148 in -[NSApplication runModalForWindow:] ()
#54 0x00003c40 in -[SCAppDelegate applicationDidFinishLaunching:]
(self=0x1029060, _cmd=0x91f45720, aNotification=0x102f390) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/SCAppDelegate.m:29
#55 0x91ad56f0 in _nsnote_callback ()
#56 0x96a5994c in _CFXNotificationPostNotification ()
#57 0x91ad2e48 in -[NSNotificationCenter
postNotificationName:object:userInfo:] ()
#58 0x94e0f5f8 in -[NSApplication _postDidFinishNotification] ()
#59 0x94e0f510 in -[NSApplication _sendFinishLaunchingNotification] ()
#60 0x94d96f08 in -[NSApplication(NSAppleEventHandling) _handleAEOpen:] ()
#61 0x94d96740 in -[NSApplication(NSAppleEventHandling)
_handleCoreEvent:withReplyEvent:] ()
#62 0x91af6014 in -[NSAppleEventManager
dispatchRawAppleEvent:withRawReply:handlerRefCon:] ()
#63 0x91af5de8 in _NSAppleEventManagerGenericHandler ()
#64 0x95ec0ce4 in aeDispatchAppleEvent ()
#65 0x95ec0bec in dispatchEventAndSendReply ()
#66 0x95ec09f0 in aeProcessAppleEvent ()
#67 0x9021902c in AEProcessAppleEvent ()
#68 0x94d9428c in _DPSNextEvent ()
#69 0x94d93a14 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#70 0x94d8d6d0 in -[NSApplication run] ()
#71 0x94d5e0d4 in NSApplicationMain ()
#72 0x00001e28 in main (argc=1, argv=0xbffff5b4) at
/Users/gotham/Desktop/PushNetworking/PushNetworking/StationTerminal/main.m:13

Any help would be greatly appreciated. I don't know if we can do without
garbage collection.

Thank You,
Bridger Maxwell
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to