I have a couple of version of lattice c installed. Its not using DOS to get free mem, its using its internal memory model and heap. It grows this as neededd using SBRK.
Therefore, the value returned by "sizmem" does not necessarily indicate how much memory is actually available. If used after calling "allmem", however, the actual memory pool size WILL be returned.
Lattice C MEMORY POOL, is not dos's free memory size.
I have a couple of version of lattice c installed. Its not using DOS to get free mem, its using its internal memory model and heap. It grows this as neededd using SBRK.
Therefore, the value returned by "sizmem" does not necessarily indicate how much memory is actually available. If used after calling "allmem", however, the actual memory pool size WILL be returned.
Lattice C MEMORY POOL, is not dos's free memory size.
what i want to display is the size of ram that i can allocate for data,
as you can see i already called allmem().
i then found that you need to declare
1long sizmem();
, weird by today's standard.
it then displays that the memory pool is 1261568bytes, this is again ridiculous as it easily breaks the 640kb barrier and is even over 1mb for computers of 1982.
then i looked up manual again, and found that in lc2.0 sizmem() returns size of memory pool in unit of bytes instead of ints, so it shall be right if i remove "freeram*=sizeof(int)".
as for old compilers(not the new ones like turboc), do you have any ideas to recommend?
there is one more question:
since allmem() allocates all available memory into the memory pool(which ought to be in the heap), does that mean there would be no memory left for the stack and i can't perform any recursive function calls?
stack is not part of the heap, its usually fixed by the EXE header. c compilers on dos dont grow stack, stack is a fixed size on link time usually. recurse too much and you will just crash.