delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/13/13:20:35

Date: Wed, 13 May 1998 13:22:54 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Timo Bingmann <timo AT hmtg DOT com>
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: <Pine.SUN.3.91.980513131638.26491A-100000@is>
MIME-Version: 1.0

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.

- Raw text -


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