🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #108

Re: How to trim program size before calling spawn() in TC

#108
From: Ralf.Brown
Date: Wed, 21 Mar 1990 12:51
29 lines
2229 bytes
In article <1990Mar21.081326.12154@calvin.spp.cornell.edu>, richard@calvin.spp.cornell.edu (Richard Brittain) wrote:
}The subject line pretty much says it all.  I want to be able to shell
}out of a small program, leaving the bare minimum behind (no heroics,
}swapping or anything like that).  The default seems to leave a full 64k
}in the tiny model (in case I have malloced a bunch of stuff I suppose).
}I have figured out how to trim the fat some by manually setting
}_stklen and _heaplen, but I did that just by trial and error.  Is there
}a way to discover the actual size and free the memory above that point
}before calling spawn().  I tried brk() but it didn't seem to do anything - 
}it still left 64k behind (maybe I gave it a silly argument and it was
}ignored). 
}The final program will either be tiny or small model, if it matters.

In tiny and small models, the stack is at the top of the data segment, which
means it is also at the top of the memory block allocated by the startup code.
BTW, brk() does not affect the DOS memory block in small-data models, it just
adjusts a runtime-code-internal pointer.

While it would be possible to shift the stack down and then back up, that would
take nearly as much work as swapping to disk.  Hmm, maybe I should release
the swapping spawn() that I use in RBcomm....

--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: Ralf Brown 1:129/46
"How to Prove It" by Dana Angluin              Disclaimer? I claimed something?
16. proof by cosmology:
    The negation of the proposition is unimaginable or meaningless.  Popular
    for proofs of the existence of God.
Technical Details
Message-ID: <260786cb@ralf>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!b.gp.cs.cmu.edu!Ralf.Brown@B.GP.CS.CMU.EDU

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!b.gp.cs.cmu.edu!Ralf.Brown@B.GP.CS.CMU.EDU
From: Ralf.Brown@B.GP.CS.CMU.EDU
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: How to trim program size before calling spawn() in TC
Message-ID: <260786cb@ralf>
Date: 21 Mar 90 12:51:07 GMT
Sender: ralf@b.gp.cs.cmu.edu
Organization: Carnegie Mellon University School of Computer Science
Lines: 29
In-Reply-To: <1990Mar21.081326.12154@calvin.spp.cornell.edu>