🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3828

Re: Using malloc() from BC++3.1 in interrupt time problem

#3828
From: Joe Huffman
Date: Fri, 16 Oct 1992 17:10
30 lines
1468 bytes
marcusj@apricot.co.uk (Marcus Jenkins) writes:

>I have been trying to use malloc() in an app. written in Borland
>C++ 3.1 ('C' only) and it *always* returns null when I call it
>as part of my interrupt routine (called off a hardware (network
>packet received) routine).  Why would this be?  

Good programming on Borland's part.

On the PC it is virtually impossible to make malloc() reentrant in the
most general case because DOS is not reentrant (malloc() may need call
DOS to request more memory).  It's also a bit tough to make malloc()
reentrant because of the need for global data.

It is better (IMHO) that malloc() detect the case of being called at 
interrupt time and return an error (NULL) every time, than try to give 
you hit and miss availability.

Joe Huffman
FlashTek, Inc.
121 Sweet Ave
Moscow, Idaho 83843
U.S.A.

FAX:    208-882-7275
Voice:  208-882-6893
Orders: 800-397-7310
-- 
netcom!proto!joe
joe@proto.com
Technical Details
Message-ID: <1992Oct16.171006.17833@proto.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!uwm.edu!caen!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!csus.edu!netcom.com!netcomsv!proto!joe
References: <1992Oct15.153148.28389@apricot.co.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!uwm.edu!caen!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!csus.edu!netcom.com!netcomsv!proto!joe
From: joe@proto.com (Joe Huffman)
Subject: Re: Using malloc() from BC++3.1 in interrupt time problem
Organization: FlashTek, Inc.
Date: Fri, 16 Oct 1992 17:10:06 GMT
Message-ID: <1992Oct16.171006.17833@proto.com>
References: <1992Oct15.153148.28389@apricot.co.uk>
Lines: 30