delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/09/12/04:08:52

Message-ID: <3418F8AA.4101@bo.dada.it>
Date: Fri, 12 Sep 1997 10:09:14 +0200
From: Diego Zuccato <dz AT bo DOT dada DOT it>
Organization: CyberSpace Software Labs BBS
MIME-Version: 1.0
To: DJ Delorie <dj AT delorie DOT com>
CC: djgpp-workers AT delorie DOT com
Subject: Re: fread slowstart
References: <199709120122 DOT VAA02054 AT delorie DOT com>

DJ Delorie wrote:

> There is no need to save it.  Whenever a program is started, the
> parent's TB has nothing but the child's argv and env in it, and the
> parent never uses them after the child returns.
Well, then why should be more than one tb be needed ?

> That's why I'm thinking of letting crt0.c do the work, instead of
> stub.asm.  crt0 would have to detect *if* a previous TB is large
> enough, shrink its own down to save space, and reconfigure itself to
> use the detected TB.
Hm. Why shrink it ? Let it be constant and avoid memory fragmentation.
If A calls B with a tb of 32K, B thinks 2K is enough and shrinks it.
Then allocates some DOS memory for its use. If B have to call C with a
really long command line (eg 20K), then it should allocate 20 more
Kbytes, prepare new tb, free old tb and then call C. Seems quite slow
and, if repeated, a lot of DOS memory is wasted in small chunks :-(
If the tb size isn't altered, it could lead to a constant 64K of DOS
memory used. In the example, we would never get fragmentation. Just a
bit of 'slack' space.

> If no TB is detected, it expands its own and stores the pointer
> somewhere in DOS memory.
Uhm... Couldn't it be possible to use some 'marker' to identify the tb ?
So it's not needed to store a pointer anywhere. Just search thru
allocated memory blocks one that starts with the given string.
It's nearly impossible that two memory blocks with a certain size start
with the same string. And to avoid that 'nearly', it could be added a
'offset' byte (eg. 1 to 3) that tells where does the actual ID string
start...

- Raw text -


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