0

For a Mac application I'm using an external (C++) library that has build in memory management. A drawback of that memory manager is that memory needs to be deleted on the same thread as the new call.

Currently I'm using GCD to run code concurrently, but I run into the problem that objects of that library get allocated on various threads and I can't correctly delete them.

Is there a way to call the delete operator on the original thread that called new? I realise that GCD wants to abstract the underlying threads away from me, but otherwise I've to write a custom GCD-like implementation where I have full control over the threads.

Remco Poelstra
  • 859
  • 6
  • 20
  • I explored the issue of thread affinity and GCD in some length on this question: http://stackoverflow.com/q/29913044/438982 and http://stackoverflow.com/q/26819074/438982 – ipmcc Feb 04 '16 at 19:15
  • Thanks, I was already afraid this wasn't going to work, so I ended up writing some sort of custom thread pool. – Remco Poelstra Feb 05 '16 at 16:16

0 Answers0