[webkit-help] "build-webkit --system-malloc" on cygwin

Russ Schnapp rls.webkit at schnapp.org
Mon May 10 10:30:11 PDT 2010

FOREWORD: This is just to relate my experience, in case someone else 
encounters a similar problem.  I'm not confident that what I'm reporting 
here is a bug in the Apple Windows port -- it's possible that the 
problem I had was somehow peculiar to my application or how I integrated 
WebKit therewith.


I'm incorporating WebKit into my client's Windows application, primarily 
in order to render SVG images, but also for some limited HTML rendering.

I had relatively little difficulty building the Apple Windows port under 
Cygwin -- though one or two things did throw me for a loop (e.g., the 
"COM" implementation sans IDispatch, which tends to be extremely useful 
for control by scripting languages and simplifies creation of C++ 
wrapper classes).

My last big roadblock was a memory allocation problem. I eventually 
figured out that, somehow, some memory resources were being allocated 
from the "fastmalloc" system in WebKit, but were being passed to the 
runtime library's delete function, which of course, doesn't recognize 
them.  It appears that my client's application was somehow seeing the 
fastmalloc stuff and inadvertently using it in some places, but not 
others, and not consistently.

I eventually decided to turn off fastmalloc when building WebKit, so 
everyone would be using the runtime library allocator.  I looked through 
WebKit/WebKitTools/Scripts/build-webkit, and found the --system-malloc 
switch, which purports to turn off fastmalloc by defining 
USE_SYSTEM_MALLOC for compilation.

Unfortunately, it appears that this switch silently fails on cygwin. In 
fact, it's not clear to me that any of the various option switches 
(other than --debug and --clean) actually do anything when building 
under cygwin.

Eventually, I had to manually edit
...appending ";USE_SYSTEM_MALLOC" on line 12 (VCCLCompilerTool's 

I then rebuilt WebKit, and all was well.

More information about the webkit-help mailing list