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

From: "Grzegorz Jablonski" <gwj AT dmcs DOT p DOT lodz DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: BUG - Exec does not free memory
Date: Sat, 12 Jun 1999 14:56:52 +0200
Organization: LODMAN - Metropolitan Area Network in LODZ
Lines: 37
Message-ID: <7jth1o$fq8$1@kujawiak.man.lodz.pl>
NNTP-Posting-Host: pc-212-51-219-21.p.lodz.pl
X-Trace: kujawiak.man.lodz.pl 929187704 16200 212.51.219.21 (12 Jun 1999 11:41:44 GMT)
X-Complaints-To: abuse AT man DOT lodz DOT pl
NNTP-Posting-Date: 12 Jun 1999 11:41:44 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