Sender: nate AT cartsys DOT com Message-ID: <37642DF4.66F6FC8E@cartsys.com> Date: Sun, 13 Jun 1999 15:17:24 -0700 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Exec does not free all memory References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > On Sat, 12 Jun 1999, Grzegorz Jablonski wrote: > > > The problem occured, when I tried to > > upgrade the program version from within the program itself. > > I don't see how this could cause any practical problems: the > conventional memory usage by each subsidiary program is about 18KB, so > you need much more than a single `exec' to eat up all the conventional > memory, unless you have 20KB to begin with. It breaks this interesting little Obfuscated C Contest winner (Applin from 1995, line breaks changed): main(v,c)char**c;{for(v[c++]="Hello, world!\n)"; (!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c) write(!!*c,*c,!!**c);} Yes, it execs itself for each letter of the message. (Note: If you try it on Unix you should use -fwritable-strings to compile.) -- Nate Eldredge nate AT cartsys DOT com