g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  Index 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014 
<== Date ==> <== Thread ==>

Subject: Re: mallocMustSucceed( 0 ) non-portable
From: Benjamin Franksen <benjamin.franksen@bessy.de>
To: core-talk@aps.anl.gov
Date: Fri, 3 Feb 2006 13:19:09 +0100
On Tuesday 31 January 2006 21:42, Andrew Johnson wrote:
> The ?allocMustSucceed() routines were always a bit of a hack to avoid
> having to check the return value from ?alloc.  They are only called
> in dbStaticLib and the IOC startup code in places where if you run
> out of memory there's no way you're going to be able to recover and
> still bring up the IOC, so the only thing you can do is bail out.

Dear Andrew

unfortunately, this is not true. The routines dbCalloc() and dbMalloc(), 
defined in dbStaticLib to be more or less synonyms for 
xxxMustSucceed(), are used all over the place. One instance I just 
stumbled over is in dbAccess.c, where dbCalloc() is used in routine 
dbPutFieldLink(). Here is a list:

aragon: .../3-14-8-2-0/src > pwd                                       
/opt/Epics/R3.14.8/base/3-14-8-2-0/src
aragon: .../3-14-8-2-0/src > grep 'db[CM]alloc' **/*.c | grep -v Static
as/asDbLib.c:    paddr = dbCalloc(1,sizeof(DBADDR) + 
sizeof(ASCLIENTPVT));
db/dbAccess.c:            pdbAddr = dbCalloc(1,sizeof(struct dbAddr));
db/dbCa.c:epicsShareFunc void * epicsShareAPI dbCalloc(size_t 
nobj,size_t size);
db/dbCa.c:    pca = (caLink*)dbCalloc(1,sizeof(caLink));
db/dbCa.c:    pca->pvname = dbCalloc(1,strlen(pvname) +1);
db/dbCa.c:            pca->pputString = 
dbCalloc(MAX_STRING_SIZE,sizeof(char));
db/dbCa.c:            pca->pputNative = dbCalloc(pca->nelements,
db/dbCa.c:                pca->pgetNative = 
dbCalloc(pca->nelements,element_size);
db/dbCa.c:                pca->pgetString = 
dbCalloc(MAX_STRING_SIZE,sizeof(char));
db/dbLock.c:        plockSet = dbCalloc(1,sizeof(lockSet));
db/dbLock.c:    plockRecord = dbCalloc(nrecords,sizeof(lockRecord));
db/dbLock.c:    paplockRecord = 
dbCalloc(nlockRecords,sizeof(lockRecord*));
db/dbNotify.c:        pputNotifyPvt = dbCalloc(1,sizeof(putNotifyPvt));
db/dbNotify.c:    pnotifyGlobal = dbCalloc(1,sizeof(notifyGlobal));
db/dbNotify.c:        precord->ppnr = 
dbCalloc(1,sizeof(putNotifyRecord));
db/dbNotify.c:        pto->ppnr = dbCalloc(1,sizeof(putNotifyRecord));
db/dbNotify.c:    pdbaddr = dbCalloc(1,sizeof(DBADDR) + len+1);
db/dbNotify.c:    ppn = dbCalloc(1,sizeof(putNotify));
db/dbNotify.c:    ptpnInfo = dbCalloc(1,sizeof(tpnInfo));
db/dbScan.c:            pevent_scan_list = 
dbCalloc(1,sizeof(event_scan_list));
db/dbScan.c:    
*ppioscanpvt=dbCalloc(NUM_CALLBACK_PRIORITIES,sizeof(io_scan_list));
db/dbScan.c:    papPeriodic = dbCalloc(nPeriodic,sizeof(scan_list*));
db/dbScan.c:    periodicTaskId = dbCalloc(nPeriodic,sizeof(void *));
db/dbScan.c:            psl = dbCalloc(1,sizeof(scan_list));
db/dbScan.c:            pse = dbCalloc(1,sizeof(scan_element));
db/dbTest.c:    papfields = dbCalloc(nfields,sizeof(char *));
misc/iocInit.c:                 pdbAddr = dbCalloc(1,sizeof(struct 
dbAddr));
rec/compressRecord.c:       pcompress->wptr = (double 
*)dbCalloc(nelements,sizeof(double));


Many of these calls are /not/ restricted to happening only during 
iocInit.

Ben

Navigate by Date:
Prev: Re: enhanced seq record Brian McAllister
Next: DBD Syntax (Arrays) Benjamin Franksen
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014 
Navigate by Thread:
Prev: RE: Patches for ARM Linux target Jeff Hill
Next: DBD Syntax (Arrays) Benjamin Franksen
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·