[Webkit-unassigned] [Bug 33570] [BREWMP] Map FastMalloc to BREW memory allocator

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 4 21:23:39 PST 2010


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





--- Comment #8 from Kwang Yul Seo <kwangyul.seo at gmail.com>  2010-02-04 21:23:39 PST ---
BREW uses RVCT or GCC for target. So malloc, calloc, realloc and free are
provided by these two compilers. However, because BREW runtime does not
initialize the heap for application, calling malloc crashes the system. To
share system heap, BREW applications must use MALLOC, CALLOC, REALLOC and FREE.


(In reply to comment #7)
> (From update of attachment 48099 [details])
> Hmmm.
> 
> Why use a #define instead of  just naming the functions malloc, calloc, etc?
> 

Naming the function malloc causes a compile error if stdlib.h is included.

void* malloc(size_t)' was declared `extern' and later `static' error.


> Maybe this code should go in its own header, which FastMalloc.cpp should
> include.  Something like SystemMallocBrew.h?
> 

I think it is a good idea.


> How do other codebases which port to BREW deal with this strange lack of
> malloc()?

One simple approach is to replace malloc, calloc, realloc and free with their
corresponding counterparts MALLOC, CALLOC, REALLOC and FREE using macros.

-- 
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