Mail Archives: djgpp/1998/04/03/15:15:42
Greg Cheak wrote:
>
> I have a program called "Cover" (circa 1993) that builds large tables in
> memory. It uses a simple call to malloc() to allocate space for these tables.
> If the call fails, it returns an error code (NULL). This is usually due to
> lack of memory to complete the operation based on the parameters I have set. I
> have 32mb RAM.
>
> The program, a Unix port, compiles straight away with DJGPP. What I would
> like to do is use DPMI (CWSDPMI) functions to allocate as much memory as I
> can, so that I can set larger paramters for this program. Even running in
> Win95 with DPMI set to 65535, the program seems not to see it. Is there sample
> code explaining the usage of DPMI in a program? I suspect I would have to use
> a swap file as well.
>
> Oh, the program builds covers ("wheels") using a process called Simulated
> Annealing. It works good for smaller designs. With extra memory I could work
> on larger ones.
>
> - Greg
Don't worry-be happy!
Allocate away. Malloc will allocate virtual memory if no
physical memory is available, and the dpmi host will patiently
swap from memory to disk behind the scene without any setup
on the part of active program. I think that cwsdpmi will handle
up to 256 meg. I suspect that the program will actually be more
efficient<sic> if you malloc your tables as you need instead of
trying to grab all the memory you can and manage it yourself.
The libc info file has a branch that covers the dpmi
functions if you need to map physical addresses, lock memory,
ect.
Charles
- Raw text -