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");
}