www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/18/09:37:33

Date: Thu, 18 Jun 1998 16:33:01 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Javier Calleja <dismuntel AT apdo DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Dynamic memory allocation in real time aplications
In-Reply-To: <01bd9aac$22753140$0100a8c0@dismuntel.ctv.es>
Message-ID: <Pine.SUN.3.91.980618162642.25361B-100000@is>
MIME-Version: 1.0

On Thu, 18 Jun 1998, Javier Calleja wrote:

>   But, must I use dynamic memory allocation with real time aplications? Is
> the O.S. fast enough in memory assignment and memory release?

It depends on how hard are your real-time constraints.  In general, current 
DJGPP malloc/free functions are very fast, but if your application needs 
a lot of small chunks, you might run out of free memory too early.  Also, 
if you run out of free physical RAM, the allocation with calloc will be 
very slow due to paging.

>  And, is the
> dynamic memory allocation a robust programming method or may the O.S. crash
> my programm?

Since in DJGPP malloc allocates virtual memory, DOS has nothing to do 
with it.  Virtual memory is supplied by the DPMI server and the 
underlying memory manager.  These are usually stable enough.  However, I 
don't advise to allocate memory (or call any other library function, for 
that matter) inside a hardware interrupt handler, since you must lock 
code and data of every function called by such handlers, and locking 
library functions is tricky.

- Raw text -


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