Mail Archives: djgpp/1995/10/04/22:00:35
Charles Sandmann <sandmann AT clio DOT rice DOT edu> wrote:
>> BTW, I use malloc(HUGE) instead of "int intarray[arraysize]".
>On huge programs, this is probably a mistake with the default djgpp malloc
>since it rounds up all requests to the nearest power of 2 before allocating
>a bucket of memory. So, malloc(8Mb+1) will actually require 16Mb of memory.
>In V1 under DPMI the memory gets zeroed, faulting it all in, which causes
>terrible performance. In V2 we no longer zero sbrk()ed memory by default.
>The easy way around this is to call sbrk() directly for large requests
>which you don't plan to free() during program execution.
Is the default djgpp malloc also in C++? I haven't noticed any
slowdown, possibly the _one_ time swap-in (or is it optimized to be
only swap-out for new memory?) is so fast I can't see any flicker from
GO32's status or hear any drive noise. I have my code parameterized
so that I can get the most out of memory without triggering swapping.
My largest array (among several) is 7,140,000 bytes on a PC with 8MB.
Lucky me, the other 1.1MB gets swapped out and then ignored.
Is this a penalty for trying to use ANSI C89 standard calls? I don't
remember sbrk as one of them.
- Raw text -