[bug #59204] NSOperationQueue leak

Richard Frith-Macdonald <[email protected]>
Newsgroups gmane.comp.lib.gnustep.bugs
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.