[Webkit-unassigned] [Bug 34569] Don't call CRASH() in fastMalloc and fastCalloc when the requested memory size is 0

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Feb 5 00:17:55 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34569





--- Comment #8 from Kwang Yul Seo <kwangyul.seo at gmail.com>  2010-02-05 00:17:53 PST ---
(In reply to comment #7)
> (From update of attachment 48192 [details])
> I don't see how checking after calling malloc is better than checking before
> calling it. Normal case just gets one more branch either way, but fastMalloc(0)
> is slower if you check after malloc returns 0.
> 

Checking after malloc is actually better than checking before calling it.
fastMalloc(n!=0) returns non-NULL unless allocation fails, so "if (!result)"
branch is not taken at all in normal case. 

malloc(0) or allocation failure take this branch and an additional check is
performed. Because both are not frequent, I think this is okay.

> We don't need to add the branch on platforms that don't return 0, please
> protect the new code with preprocessor checks. Any future port that runs into
> this can add themselves to the check.

I agree. I will add guards. 

> 
> >         (WTF::fastRealloc):
> 
> You still had this in ChangeLog.

Ooops. Sorry for the mistake.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list