nvidia-smi screenshot
The process with PID 14420 is a zombie process and its parent id is 1(init). I want to clear 4436MiB memory occupied by this zombie process without rebooting.
How should I proceed?
To prevent of zombie processes you need to tell the parent to wait for the child, until the child's terminates the process. Down here you have an example code that you can use the waitpid() function.
The parent process reads the exit status of a zombie process using the wait() function. Then the zombie process is eliminated from the system. After its removal, the process table entry and the process ID can be reused. If the wait() is not used by the parent, the zombie remains in the process table.
Zombie processes usually occur for child processes, as the parent process still needs to read its child's exit status. Once this is done using the wait system call, the zombie process is eliminated from the process table.
You HAVE to reboot as there is no other way, since the parent is init.
If the zombie process is created every time, all you can do is, you can log the processes and find out the program responsible for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With