www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/04/22:00:35

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2405
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!ix.netcom.com!netnews
From: kubler AT ix DOT netcom DOT com (Douglas Kubler)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Some "stupid" questions from a new user
Date: Wed, 04 Oct 1995 02:42:30 GMT
Organization: Netcom
Lines: 23
References: <DFMsty DOT Mtw AT jade DOT mv DOT net> <44g2h2$lft AT ixnews6 DOT ix DOT netcom DOT com> <306bf175 DOT sandmann AT clio DOT rice DOT edu>
Nntp-Posting-Host: ix-tok1-19.ix.netcom.com
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019