4 ms·
the best way to do it: don't require memory reclamation in your design. I coded a lock free IPC interface from standard C to C#. Luckily in my case the data
by rootw0rm 9y ago
the best way to do it: don't require memory reclamation in your design.
I coded a lock free IPC interface from standard C to C#. Luckily in my case the data I was moving originated on the stack. So all I do is copy from stack to shared IPC buffer and obviously keep using that same buffer until exit.
HOWEVER, if you're competent enough to handle raw threads and lock free design to begin with, you shouldn't have the slightest issue with queuing up your calls to free(). My workstation is old, but I still have 6 cores/12 threads @ 4.2 GHz. That's more than enough headroom to have a dedicated GC thread that has zero effect on performance, and a barely noticeable effect on memory.
Proper concurrency is not that difficult.
- anarazel 9y agoThe difficulty isn't calling free, it's to know when it's safe to do so, without incurring significant overhead.