views:

43

answers:

3

Sorry to repeat a question that has been posed repeatedly, but i couldn't find a specific mention of memory issues. if a process terminates with _exit(0) or _Exit(0) can its memory block be lost to the OS? Thanks, -nuun

+3  A: 

Not on any decent modern O/S (Unix, Windows, whatever) - the O/S will reclaim the process's memory when the process dies, regardless of how cleanly it died.

Alnitak
A: 

In general, no. Operating systems handle that stuff for us.

Nathon
+1  A: 

For just about any consumer O/S that will not happen. Modern multi-process Operating Systems will release any resources the process may have acquired (memory, locks, open files, etc) when the process shuts down. So I generally feel that memory or resource leaks "don't count" as leaks if I just acquire them at startup (not during runtime possibly repeatedly).

However, there are still lots of embedded/realtime platforms out there for which that is not true. If your program might be run on one of those, you should be scrupulous about freeing up acquired resources. But even there it is often easier to just reboot the device after each use...

T.E.D.