Date: Thu, 18 Jun 1998 16:33:01 +0300 (IDT) From: Eli Zaretskii To: Javier Calleja 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.