[Webkit-unassigned] [Bug 18670] fastMalloc should crash on failed allocs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 23 18:17:46 PDT 2008


http://bugs.webkit.org/show_bug.cgi?id=18670





------- Comment #5 from eric at webkit.org  2008-04-23 18:17 PDT -------
(In reply to comment #4)
> How can it be replaced by a check against a fixed size?  Allocating a very
> large number of a smaller strings can trigger a situation that will lead to
> fastMalloc failing just as easily as allocating a small number of very large
> strings.

Sure, and that fastMalloc should fail (like it would today), and CRASH right
then and there (like it should, but doesn't today).  The only "valid"
fastMalloc failure conditions, are when fastMalloc is used as a integer size
check for large user-provided data.  Those can be replaced with a check against
some arbitrary fixed size.  ("WebCore does not support allocating more than 2G
of data", or more likely a much smaller number.)

You end up with two (logical) allocators. One which does small allocations, and
never fails (when it does, you CRASH then and there.)  A second, which could be
used for larger allocations, but that you have to null check (what we have
today).

Hum... I guess another way to look at this is to just turn fastMalloc into a
wrapper function around a new fastMallocInternal() brave clients who are sure
they will NULL check, can use the internal one.  Less brave clients get the
wrapper by default, which CRASHs on NULL.


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



More information about the webkit-unassigned mailing list