Date: Wed, 13 May 1998 13:22:54 +0300 (IDT) From: Eli Zaretskii To: Timo Bingmann cc: djgpp AT delorie DOT com Subject: Re: DJGPP TSR and C++'s new command In-Reply-To: <6j9l7i$1vb$1@news.LF.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Tue, 12 May 1998, Timo Bingmann wrote: > Is it possible to malloc and free or new and delete memory in interrupts and > callbacks in a TSR??? Since writing a TSR requires DPMI 1.0 calls, this would mean that you use either CWSDPMI or 386Max, is it correct? If so, this question boils down to whether the DPMI host is reentrant, since any call to malloc/new might result in a call to DPMI functions via sbrk. If the foreground task is also a DJGPP program, then the interrupt that awoke your TSR could have happened while the foreground program was itself in the middle of sbrk; hence the reentrancy issue. Also, allocating memory might result in paging, which means a DOS call. And DOS calls don't mix well with TSRs. So I would advise to stay clear of memory allocation inside an interrupt.