delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/12/08:25:30

From: "Grzegorz Jablonski" <gwj AT dmcs DOT p DOT lodz DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Exec does not free all memory
Date: Sat, 12 Jun 1999 14:59:45 +0200
Organization: LODMAN - Metropolitan Area Network in LODZ
Lines: 38
Message-ID: <7jth75$fqf$1@kujawiak.man.lodz.pl>
NNTP-Posting-Host: pc-212-51-219-21.p.lodz.pl
X-Trace: kujawiak.man.lodz.pl 929187877 16207 212.51.219.21 (12 Jun 1999 11:44:37 GMT)
X-Complaints-To: abuse AT man DOT lodz DOT pl
NNTP-Posting-Date: 12 Jun 1999 11:44:37 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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


Grzegorz Jablonski
gwj AT dmcs DOT p DOT lodz DOT pl


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019