Mail Archives: djgpp/1998/03/02/05:22:36
On 28 Feb 1998, Radar wrote:
> Is there a simple way to return allocated pages to dpmi server ?
No, there is no easy way. In fact, I believe that in DJGPP this is
downright impossible.
But I also don't understand why would you need to do that. As far as I
understand your problem, this won't help you.
> I have
> browsed __dpmi functions and
> __dpmi_mark_page_as_demand_paging_candidate looks it could do something
> like that.
This is an advisory function. It doesn't make sure that the page will be
swapped out.
> I could use __dpmi_allocate_memory and __dpmi_free_memory
> instead of malloc and free, but I don't know
> how to access allocated memory with address or selector.
I suggest to not do that. There's no need to reinvent the wheel (it is,
in this case, pretty hard to reinvent right).
> I need big array of numbers and to measure performance of algorithms on
> them, so if program swaps the result is bad. I need to control (or at least
> to know) if allocated memory is physical or swaps to disk.
Use the functions which report the remaining free physical memory. They
correctly report the amount of available physical RAM if you call them at
program startup, before any significant allocations by your code. You
then can estimate how much can you allocate without risking to page.
(Consult the FAQ for finer details about quirks in specific environments,
such as Windows.) If you need to reallocate after that, I'd suggest
keeping track in your code how much has been allocated/freed.
- Raw text -