richard@calvin.spp.cornell.edu (Richard Brittain) (03/21/90)
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. Thanks for any help. Richard Brittain, School of Elect. Eng., Upson Hall Cornell University, Ithaca, NY 14853 ARPA: richard@calvin.spp.cornell.edu UUCP: {uunet,uw-beaver,rochester,cmcl2}!cornell!calvin!richard
Ralf.Brown@B.GP.CS.CMU.EDU (03/21/90)
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.