Date: Thu, 2 May 1996 09:48:56 +0200 (IST) From: Eli Zaretskii To: Ansel Sermersheim Cc: djgpp AT delorie DOT com Subject: Re: V2 vs. 1.12m5 In-Reply-To: <4m5nlb$cib@news.wco.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 30 Apr 1996, Ansel Sermersheim wrote: > I also have to use the unix sbrk algorithm (until I write my own heap > functions). It's not a problem, it seems to work fine. However, I'd like > t know what tradeoff I'm making. Is malloc() slower under the unix sbrk? > Does it take more memory for housekeeping? There's gotta be a catch! There is a catch, all right. In fact, there are few of them: 1) Under some DPMI hosts (notably, QDPMI, except in the latest versions) you will be effectively denied virtual memory when using unixy sbrk algorithm (i.e., you can only allocate memory as much as you have physically free). 2) You shouldn't use it in programs that install their own hardware interrupt handlers (because there is a small window of time when a hardware interrupt can crash your system when you use unixy sbrk). 3) Support for `nearptr' access to memory-mapped hardware is more tricky (and thus can have more bugs, although none are known at this time). The facts that most (all?) the other protected-mode environments use the default (non-unixy) algorithm should tell something.