View Single Post
Old 10-26-2008, 11:27 AM   #3
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Yes, the system resource that I mentioned above is available memory.

In popen, I call pclose (not close). If pclose and close can do the same work, then I should have re-collected unused momroy. Exausted available memory should not happen in this scenario. Quite strange.

In fork scenario, I call execlp to execute unzip/unrar in child process. I supposed that after executed execlp, the child process is ended. Can't OS re-collect the memory occupied by child process?
According to your words, I have to call waitpid() to free occupied memory. I will try it. Thanx.

Added:
I checked your xepdmgr.c. I think the relevant section are:
Code:
static
int ReapChildren(int Pid)
{
        int reaped_pid,status;
        while(1) {
                reaped_pid=waitpid(-1,&status,WNOHANG|WUNTRACED);
                if(reaped_pid<=0)
                        break;
                if(reaped_pid==Pid)
                        return(0);
        }
        return(-1);
}

Last edited by ericshliao; 10-26-2008 at 11:31 AM.
ericshliao is offline   Reply With Quote