3 ms·
One thing I just noticed is that the example doesn't make sure to actually run the new thread to completion before the main thread exists. This means that if y
by dathinab 6y ago
One thing I just noticed is that the example doesn't make sure to actually run the new thread to completion before the main thread exists.
This means that if you do a "drop in other thread" and then main exists, the drop might never run. Which is often fine as the exit of main causes process termination and as such will free the memory normally anyway.
But it would be a problem one some systems where memory cleanup on process exit is less reliable. Through such systems are more rare by now I think.
- ReactiveJelly 6y agoIt would have to be a non-desktop system. I'm pretty sure Linux will always free process-private memory, and threads, and file descriptors when a process exits. The only things that can leak in typical cases are some kinds of shared memory and maybe child processes?