bug-gnustep
[Top][All Lists]
Advanced

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

[bug #59204] NSOperationQueue leak


From: Richard Frith-Macdonald
Subject: [bug #59204] NSOperationQueue leak
Date: Wed, 30 Sep 2020 05:15:10 -0400 (EDT)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36

Update of bug #59204 (project gnustep):

             Open/Closed:                    Open => Analyzed               

    _______________________________________________________

Follow-up Comment #6:

Having investigated, I think your problem is not a leak, but one of timing.

Your testcase waits for the operation to complete, but completion of an
operation takes place *before* the operation is released/deallocated.  So
completion of the operation in its thread can wake the main thread (which
prints the retain count) before the object retain count is decremented giving
the impression of a leak where none exists.
You can check this by adding a short delay to allow the other thread to
release the object
eg.
   [NSThread sleepForTimeInterval: 0.1];
between calling -test and printing the retain count.

While looking at this, I did notice that if the operation autoreleases objects
they will be caught by the outer autorelease pool of the thread and may
persist until the thread ends.  So I changed the code in trunk to wrap
execution of each individual operation in its own pool.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59204>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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