[comp.os.msdos.programmer] system

francis@atmos.cse.ogi.edu (Francis Moraes) (06/10/91)

I compiled the following program using Turbo C under all of its memory
models:

main()
{
   system("vtsr");
}

Vtsr is a program that lists the programs in memory and the amount of memory
allocated to it. The amount of memory in kilobytes used by this program are
given below for each of the memory models:

model	memory usage
====================
tiny	64.2
small	66.7
compact	9.0
medium	66.8
large	10.0
huge	10.0

I think it is interesting that the memory models that use far pointers for
data have smaller memory usage than those with near data pointers. Does anyone
know why this is so?  The same problem exists with the exec() function. I
hope this isn't a stupid question. Send me mail or post as you see fit. If
I get enough mail I will post a summary.

Ralf.Brown@B.GP.CS.CMU.EDU (06/10/91)

In article <22566@ogicse.ogi.edu>, francis@atmos.cse.ogi.edu (Francis Moraes) wrote:
}I compiled the following program using Turbo C under all of its memory
}models:
}
}main()
}{
}   system("vtsr");
}}
}
}Vtsr is a program that lists the programs in memory and the amount of memory
}allocated to it. The amount of memory in kilobytes used by this program are
}given below for each of the memory models:
}[omitted]
}
}I think it is interesting that the memory models that use far pointers for
}data have smaller memory usage than those with near data pointers. Does anyone
}know why this is so?  The same problem exists with the exec() function. I

That's the effect of the near heap.  Add the line

       _heaplen = 100 ;

at the beginning of the program and watch the memory use drop.	(You may
have to increase the value if system() needs more than 100 bytes of heap).

-- 
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/53
BITnet: RALF%CS.CMU.EDU@CARNEGIE   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | It isn't what we don't know that gives us trouble, it's
I claim something?| what we know that ain't so.  --Will Rogers