Skip to content
Tcl Source Code View Ticket
Login

View Ticket

malloc returns NULL and causes core

Closed / Fixed218198ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:54:24
OriginalBugID: 2399 Bug
Version: 8.0p2
SubmitDate: '1999-07-19'
LastModified: '1999-08-05'
Severity: CRIT
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Other
Machine: NA
FixedDate: '2000-10-25'
ClosedDate: '1999-08-05'


Name:
christopher costello

ReproducibleScript:
Run any tcl application until memory is exhausted. If the #defines are
    set to use normal malloc/free, then a NULL pointer will be used in the
    (multiple) places in the tcl source where the result is not checked.
    Since memory exhaustion cannot in principle be excluded, this suggests
    that your design approach means that one must always compile with
    TCL_MEM_DEBUG or USE_TCLALLOC or risk a core. A better solution would be
    to check the return value of all mallocs at the place of call, where the
    action appropriate for recovery is knowable.



Tcl does not check against the return values of mallocs because
the philosophy is that if you are out of memory, you are screwed
one way or the other.  To get a NULL and panic (thus aborting)
gives you just about the same result.  Adding in all the checks
would just cause a performance hit. 
-- 08/05/1999 hobbs
welch Closed ticket [218198ffff]. [History diff]2000-10-26 08:16:56
dgp Ticket [218198ffff]: 3 changes [History diff]2001-04-16 20:45:16
Log in (anonymous is fine) to add a comment.