• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Over-released Paragraph Style - Driving Me NUTS!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Over-released Paragraph Style - Driving Me NUTS!


  • Subject: Re: Over-released Paragraph Style - Driving Me NUTS!
  • From: Murat Konar <email@hidden>
  • Date: Mon, 23 Oct 2006 20:34:36 -0700
  • Resent-date: Mon, 23 Oct 2006 20:35:03 -0700
  • Resent-from: Murat Konar <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: Dev Cocoa <email@hidden>

It looks like you are initiating, or causing to be initiated, some sort of URL loading activity. Are you perchance allocating your paragraph style in response to some downloaded information? Does this happen on the main thread?Are you creating any autorelease pools yourself?

Is your singleton class retained? I.e, it's not getting autoreleased, and taking your paragraph style with it is it? When is your singleton created?

Since you think you're not doing any work outside the main thread, verify that belief by sprinkling your code with assertions to that effect:

	#import <pthread.h>
	...
	NSAssert (pthread_main_np(), @"*** Not on main thread!!!");

_murat


p.s. probably unrelated to this problem, but I believe it's not a best practice to call methods of an object that hasn't been initialized yet. You do this in your singleton's init method.





On Oct 23, 2006, at 7:41 PM, Seth Willits wrote:

On Oct 23, 2006, at 7:17 PM, Murat Konar wrote:

It's not hard to reproduce. I have a 100% repeatable test case.

But I think Cameron is on to something: is your app multi- threaded? I've been puzzling over your problem too and have been wondering if your problem is related to threads or perhaps even multiple run loops.


This sounds an awful lot like an autorelease pool is getting released and your paragraph style with it.

Yes, that's exactly what's happening.


The question is when the autorelease pool in question is getting released. Normally, you have the autorelease pool that gets released after every run loop iteration, and if you're in a multithreaded situation, your threads may also have autorelease pools associated with them. You need to make sure your object is getting added to the proper autorelease pool or it can easily get released out from under you.

Well, there are 4 threads according to the debugger, but I don't create any of them and AFAIK they're all just typical background junk (because of debugging?).


Thread 1 is the main thread as expected.

Thread 2:
  #0  0x9002bbc8 in semaphore_wait_signal_trap
  #1  0x900306ac in pthread_cond_wait
  #2  0x9159a224 in pthreadSemaphoreWait
  #3  0x915994c0 in CMMConvTask
  #4  0x9002b508 in _pthread_body

Thread 3:
#0 0x9000ab48 in mach_msg_trap
#1 0x9000aa9c in mach_msg
#2 0x907dcb78 in __CFRunLoopRun
#3 0x907dc47c in CFRunLoopRunSpecific
#4 0x9298869c in +[NSURLConnection(NSURLConnectionInternal) _resourceLoadLoop:]
#5 0x92961194 in forkThreadForFunction
#6 0x9002b508 in _pthread_body


Thread 4:
  #0  0x9001f08c in select
  #1  0x907ef40c in __CFSocketManager
  #2  0x9002b508 in _pthread_body


There's nothing fancy going on in my code with respect to threads. Certainly not at this point.


Multiple people have said ObjectAlloc *does* watch retain & release cycles but despite checking the checkbox to enable that, I don't see ObjectAlloc doing it. I'd really like to see if I'm doing something wrong here or what.


-- Seth Willits



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Over-released Paragraph Style - Driving Me NUTS!
  • Next by Date: Re: Over-released Paragraph Style - Driving Me NUTS!
  • Previous by thread: Re: Over-released Paragraph Style - Driving Me NUTS!
  • Next by thread: Screensaver bundle install problems
  • Index(es):
    • Date
    • Thread