www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000288

When Created: 06/12/1999 07:00:36
Against DJGPP version: 2.00
By whom: gwj@dmcs.p.lodz.pl
Abstract: Exec does not free all memory
When the program below (run as parent.exe 0) is run, it eventually allocates all the dos memory and quits. Similar program compiled with Borland C 3.1 works correctly. I suspect that the problem is probably with the transfer buffer, which is not freed after exec. The problem occured, when I tried to upgrade the program version from within the program itself.

#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "process.h"
#include "malloc.h"
#include "string.h"
#include <go32.h>

main(int argc, char *argv[])

{
   char tbuf[256],a;
   int i=0;
   unsigned long mlen;

   i=atoi(argv[1]);

   printf("Call %d, PSP: %lx\n",i,_go32_info_block.linear_address_of_original_psp);
   sprintf(tbuf,"%d",i+1);
   a=getch();
   if(a=='q')
      return 1;
   execlp("parent.exe","parent.exe",tbuf,NULL);
   printf("after exec\n");
}

Note added: 06/13/1999 06:00:45
By whom: eliz@is.elta.co.il
This is not a bug: execXX are simply spawnXX in disguise.

In other words, the parent program isn't terminated when the child
is invoked.  Therefore, the parent's memory (not just DOS memory, ALL
memory) cannot be freed until the child exits.

I'm closing this bug report.

Closed on 06/13/1999 06:00:32: This is how execXX functions are supposed to work.
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010