It isn't so easy to return amount of memory left in a Windows environment,
since the memory architecture looks so much differnt.
Howerver, i assume that the old program was running under DOS, i.e.
limited to 640kB memory. Because of the great increase of available memory
together with swap space, most programs don't need to bother keeping track
of amount of free space.
If you really want to look into it, there are a number of Win32 API calls
to check on the memory subsystem, but is your program regularly
expected to consume 50-500 MB or more?
The two main things to care about are:
- not leaking memory, maging the app requiring regular restarts.
- handling a failed memory allocation (NULL pointer or exception depending
on how application is configured to behave).
Just for fun, the app might keep track of amount of memory it has
allocated, to warn users that operation xx might require huge amounts of
memory (for example undo of a global search/replace in a megalarge
spreadsheet, text document, ...)
/Per W
On Thu, 16 Feb 2006, Patrick Hens wrote:
> Hi,
>
> I'm porting some c source code for a DOS program written with Borland. Now I've noticed that the Devc libraries do not contain the coreleft() function. I would like to know the amount of free memory left in my program.
>
> Does anyone know an alternative way to do this?
>
> PS: I've tried to search the archives, but the search engine does not seem to work (Can not connect to server). Did not find any answers with Google either.
>
> Thanks in advance,
>
> Patrick Hens
|