Mail Archives: djgpp/1998/05/13/13:20:35
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 -