Bug 89358 - Causes crashes in LLVMPipe
Summary: Causes crashes in LLVMPipe
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Linux
: P2 Critical
Assignee: Gustavo Noronha (kov)
URL:
Keywords:
: 89469 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-18 10:04 PDT by Bastien Nocera
Modified: 2012-06-22 05:41 PDT (History)
6 users (show)

See Also:


Attachments
Patch (1.18 KB, patch)
2012-06-18 11:47 PDT, Gustavo Noronha (kov)
no flags Details | Formatted Diff | Diff
Patch (1.21 KB, patch)
2012-06-18 11:51 PDT, Gustavo Noronha (kov)
no flags Details | Formatted Diff | Diff
Patch (1.01 KB, patch)
2012-06-21 05:25 PDT, Gustavo Noronha (kov)
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bastien Nocera 2012-06-18 10:04:49 PDT
webkitgtk3-1.8.1-2.fc17.x86_64

See https://bugzilla.gnome.org/show_bug.cgi?id=674628 and https://bugs.freedesktop.org/show_bug.cgi?id=48441

Apparently caused by gnome-control-center's GOA panel loading WebKitGTK+, which overrides the new and delete operators, which means changes the allocator and destructor defaults for all C++ code.

This makes LLVM Pipe explode.

Full explanation from Dave Airlie:
https://plus.google.com/104877287288155269055/posts/grHDgRNc1gi

#0  0x00007f823bef2c35 in raise () from /lib/libc.so.6
No symbol table info available.
#1  0x00007f823bef40b8 in abort () from /lib/libc.so.6
No symbol table info available.
#2  0x00007f823bf30e5b in __libc_message () from /lib/libc.so.6
No symbol table info available.
#3  0x00007f823bf36a56 in malloc_printerr () from /lib/libc.so.6
No symbol table info available.
#4  0x00007f822bcad5d8 in std::string::reserve(unsigned long) () from /usr/lib/libstdc++.so.6
No symbol table info available.
#5  0x00007f822bcad865 in std::string::append(char const*, unsigned long) () from /usr/lib/libstdc++.so.6
No symbol table info available.
#6  0x00007f8221e4edfe in llvm::sys::getHostTriple() () from /usr/lib/xorg/modules/dri/nouveau_dri.so
No symbol table info available.
#7  0x00007f8221963e78 in llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) () from /usr/lib/xorg/modules/dri/nouveau_dri.so
No symbol table info available.
#8  0x00007f82219581ad in llvm::EngineBuilder::create() () from /usr/lib/xorg/modules/dri/nouveau_dri.so
No symbol table info available.
#9  0x00007f82219632eb in LLVMCreateJITCompilerForModule () from /usr/lib/xorg/modules/dri/nouveau_dri.so
No symbol table info available.
#10 0x00007f8221676606 in init_gallivm_state (gallivm=0x1fe51b0) at gallivm/lp_bld_init.c:257
        optlevel = <optimized out>
        error = 0x0
        __FUNCTION__ = "init_gallivm_state"
#11 0x00007f822167674b in gallivm_create () at gallivm/lp_bld_init.c:429
No locals.
#12 0x00007f82215e1325 in draw_create_context (pipe=pipe@entry=0x1fd2980, try_llvm=try_llvm@entry=1 '\001', gallivm=gallivm@entry=0x0)
    at draw/draw_context.c:82
        draw = 0x1fd3530
#13 0x00007f82215e139c in draw_create (pipe=pipe@entry=0x1fd2980) at draw/draw_context.c:116
No locals.
#14 0x00007f82213bfb95 in nv50_create (pscreen=0x1fbbf30, priv=0x0) at nv50_context.c:146
        nv50 = 0x1fd2980
        pipe = 0x1fd2980
        __PRETTY_FUNCTION__ = "nv50_create"
#15 0x00007f8221427c4c in st_api_create_context (stapi=<optimized out>, smapi=0x1fbbe80, attribs=0x7fffffdfc110, error=0x7fffffdfc10c, shared_stctxi=0x0)
    at state_tracker/st_manager.c:631
        shared_ctx = <optimized out>
        st = <optimized out>
        pipe = <optimized out>
        mode = {rgbMode = 0 '\000', floatMode = 0 '\000', colorIndexMode = 0 '\000', doubleBufferMode = 0, stereoMode = 938064238, 
          haveAccumBuffer = 130 '\202', haveDepthBuffer = 127 '\177', haveStencilBuffer = 0 '\000', redBits = -2113440, greenBits = 32767, 
          blueBits = 33363936, alphaBits = 0, redMask = 4294967295, greenMask = 0, blueMask = 8, alphaMask = 0, rgbBits = -2113440, indexBits = 32767, 
          accumRedBits = 0, accumGreenBits = 0, accumBlueBits = 33275072, accumAlphaBits = 0, depthBits = 557263087, stencilBits = 32642, 
          numAuxBuffers = 568808090, level = 32642, visualRating = 33444208, transparentPixel = 0, transparentRed = 33444208, transparentGreen = 0, 
          transparentBlue = 33363936, transparentAlpha = 0, transparentIndex = 33363840, sampleBuffers = 0, samples = 0, maxPbufferWidth = 32642, 
          maxPbufferHeight = 568809008, maxPbufferPixels = 32642, optimalPbufferWidth = -2106724, optimalPbufferHeight = 32767, swapMethod = 0, 
---Type <return> to continue, or q <return> to quit---
          bindToTextureRgb = 0, bindToTextureRgba = 0, bindToMipmapTexture = 0, bindToTextureTargets = 0, yInverted = 0, sRGBCapable = 1005829594}
        api = API_OPENGL
#16 0x00007f822137404a in dri_create_context (api=<optimized out>, visual=0x1fe4480, cPriv=<optimized out>, major_version=<optimized out>, 
    minor_version=<optimized out>, flags=<optimized out>, error=0x7fffffdfc1fc, sharedContextPrivate=0x0) at dri_context.c:110
        sPriv = 0x1fbbcc0
        screen = 0x1fbbe80
        stapi = 0x7f82223b92e0
        ctx = 0x1fd1760
        st_share = 0x0
        attribs = {profile = ST_PROFILE_DEFAULT, major = 1, minor = 0, flags = 0, visual = {buffer_mask = 19, color_format = PIPE_FORMAT_B8G8R8A8_UNORM, 
            depth_stencil_format = PIPE_FORMAT_Z24_UNORM_S8_UINT, accum_format = PIPE_FORMAT_NONE, samples = 2, render_buffer = ST_ATTACHMENT_BACK_LEFT}}
        ctx_err = ST_CONTEXT_SUCCESS
#17 0x00007f822136ffbe in dri2CreateContextAttribs (screen=0x1fbbcc0, api=<optimized out>, config=0x1fe4480, shared=<optimized out>, 
    num_attribs=num_attribs@entry=0, attribs=attribs@entry=0x0, error=error@entry=0x7fffffdfc1fc, data=0x1fd15c0)
    at ../../../../src/mesa/drivers/dri/common/dri_util.c:260
        context = <optimized out>
        modes = 0x1fe4480
        shareCtx = 0x0
        mesa_api = <optimized out>
        major_version = <optimized out>
        minor_version = <optimized out>
        flags = <optimized out>
        __PRETTY_FUNCTION__ = "dri2CreateContextAttribs"
#18 0x00007f822137017d in dri2CreateNewContextForAPI (screen=<optimized out>, api=<optimized out>, config=<optimized out>, shared=<optimized out>, 
    data=<optimized out>) at ../../../../src/mesa/drivers/dri/common/dri_util.c:278
        error = 0
#19 0x00007f822dee29ff in dri2_create_context (base=0x1f930a0, config_base=0x1fef470, shareList=<optimized out>, renderType=<optimized out>)
    at dri2_glx.c:213
        pcp = 0x1fd15c0
        pcp_shared = <optimized out>
        psc = 0x1f930a0
        config = 0x1fef470
        shared = 0x0
#20 0x00007f822debd4d7 in CreateContext (dpy=0x1bfa830, generic_id=203, config=0x1fef470, shareList_user=0x0, allowDirect=1, code=code@entry=24, 
    renderType=32788, screen=0) at glxcmds.c:276
        gc = 0x0
        psc = <optimized out>
        shareList = <optimized out>
#21 0x00007f822debd75a in glXCreateNewContext (dpy=<optimized out>, fbconfig=<optimized out>, renderType=<optimized out>, shareList=<optimized out>, 
    allowDirect=<optimized out>) at glxcmds.c:1647
        config = <optimized out>
Comment 1 Bastien Nocera 2012-06-18 10:05:44 PDT
If somebody has time to debug this, compile WebKit with --disable-fast-malloc.
Comment 2 Gustavo Noronha (kov) 2012-06-18 10:14:05 PDT
Let's see if Mark has an insight into this. I think the problem is LLVMPipe is using free instead of delete for memory allocated with new?
Comment 3 Mark Rowe (bdash) 2012-06-18 10:21:36 PDT
What call is std::string::reserve making that results in malloc_printerr being called?
Comment 4 Bastien Nocera 2012-06-18 10:30:25 PDT
I'm guessing this would be useful. Valgrind output of the crash:

==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D445D7: std::string::reserve(unsigned long) (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x20D44864: std::string::append(char const*, unsigned long) (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x2611D1AD: llvm::operator+=(std::string&, llvm::StringRef) (StringRef.h:464)
==16286==    by 0x2618E2E4: llvm::sys::getHostTriple() (Host.inc:50)
==16286==    by 0x259B10F9: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:38)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==    by 0x259B06DD: LLVMCreateJITCompilerForModule (ExecutionEngineBindings.cpp:129)
==16286==    by 0x259B07E9: LLVMCreateJITCompiler (ExecutionEngineBindings.cpp:162)
==16286==    by 0x25933194: init_gallivm_state (lp_bld_init.c:257)
==16286==    by 0x259334EB: gallivm_create (lp_bld_init.c:429)
==16286==    by 0x2588BA00: draw_create_context (draw_context.c:82)
==16286==  Address 0x274aa4d8 is not stack'd, malloc'd or (recently) free'd
==16286== 
==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D438CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x2618E3E0: llvm::sys::getHostTriple() (Host.inc:65)
==16286==    by 0x259B10F9: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:38)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==    by 0x259B06DD: LLVMCreateJITCompilerForModule (ExecutionEngineBindings.cpp:129)
==16286==    by 0x259B07E9: LLVMCreateJITCompiler (ExecutionEngineBindings.cpp:162)
==16286==    by 0x25933194: init_gallivm_state (lp_bld_init.c:257)
==16286==    by 0x259334EB: gallivm_create (lp_bld_init.c:429)
==16286==    by 0x2588BA00: draw_create_context (draw_context.c:82)
==16286==    by 0x2588BAA8: draw_create (draw_context.c:116)
==16286==    by 0x255B99DB: nv50_create (nv50_context.c:146)
==16286==  Address 0x274a9380 is not stack'd, malloc'd or (recently) free'd
==16286== 
==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D438CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x259B112B: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:38)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==    by 0x259B06DD: LLVMCreateJITCompilerForModule (ExecutionEngineBindings.cpp:129)
==16286==    by 0x259B07E9: LLVMCreateJITCompiler (ExecutionEngineBindings.cpp:162)
==16286==    by 0x25933194: init_gallivm_state (lp_bld_init.c:257)
==16286==    by 0x259334EB: gallivm_create (lp_bld_init.c:429)
==16286==    by 0x2588BA00: draw_create_context (draw_context.c:82)
==16286==    by 0x2588BAA8: draw_create (draw_context.c:116)
==16286==    by 0x255B99DB: nv50_create (nv50_context.c:146)
==16286==    by 0x2562A8E4: st_api_create_context (st_manager.c:631)
==16286==  Address 0x274ab6c8 is not stack'd, malloc'd or (recently) free'd
==16286== 
==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D438CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x259B16AD: llvm::Triple::~Triple() (Triple.h:41)
==16286==    by 0x25AA0571: createX86MCCodeGenInfo(llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (X86MCTargetDesc.cpp:375)
==16286==    by 0x25C6725B: llvm::Target::createMCCodeGenInfo(llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) const (TargetRegistry.h:281)
==16286==    by 0x25C65080: llvm::LLVMTargetMachine::LLVMTargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (LLVMTargetMachine.cpp:115)
==16286==    by 0x259B1A9B: llvm::X86TargetMachine::X86TargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model, bool) (X86TargetMachine.cpp:73)
==16286==    by 0x259B1977: llvm::X86_64TargetMachine::X86_64TargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (X86TargetMachine.cpp:61)
==16286==    by 0x259B3489: llvm::RegisterTargetMachine<llvm::X86_64TargetMachine>::Allocator(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (TargetRegistry.h:1015)
==16286==    by 0x259B15C0: llvm::Target::createTargetMachine(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) const (TargetRegistry.h:337)
==16286==    by 0x259B1478: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:90)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==  Address 0x274ab620 is not stack'd, malloc'd or (recently) free'd
==16286== 
==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D438CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x259B16AD: llvm::Triple::~Triple() (Triple.h:41)
==16286==    by 0x25AA03E0: createX86MCAsmInfo(llvm::Target const&, llvm::StringRef) (X86MCTargetDesc.cpp:326)
==16286==    by 0x25C6720E: llvm::Target::createMCAsmInfo(llvm::StringRef) const (TargetRegistry.h:272)
==16286==    by 0x25C6509F: llvm::LLVMTargetMachine::LLVMTargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (LLVMTargetMachine.cpp:116)
==16286==    by 0x259B1A9B: llvm::X86TargetMachine::X86TargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model, bool) (X86TargetMachine.cpp:73)
==16286==    by 0x259B1977: llvm::X86_64TargetMachine::X86_64TargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (X86TargetMachine.cpp:61)
==16286==    by 0x259B3489: llvm::RegisterTargetMachine<llvm::X86_64TargetMachine>::Allocator(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (TargetRegistry.h:1015)
==16286==    by 0x259B15C0: llvm::Target::createTargetMachine(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) const (TargetRegistry.h:337)
==16286==    by 0x259B1478: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:90)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==  Address 0x274ab5e8 is not stack'd, malloc'd or (recently) free'd
==16286== 
==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D438CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x259B16AD: llvm::Triple::~Triple() (Triple.h:41)
==16286==    by 0x25A9FC59: llvm::X86_MC::getDwarfRegFlavour(llvm::StringRef, bool) (X86MCTargetDesc.cpp:134)
==16286==    by 0x25A690A6: llvm::X86RegisterInfo::X86RegisterInfo(llvm::X86TargetMachine&, llvm::TargetInstrInfo const&) (X86RegisterInfo.cpp:59)
==16286==    by 0x25A500BB: llvm::X86InstrInfo::X86InstrInfo(llvm::X86TargetMachine&) (X86InstrInfo.cpp:93)
==16286==    by 0x259B19D7: llvm::X86_64TargetMachine::X86_64TargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (X86TargetMachine.cpp:61)
==16286==    by 0x259B3489: llvm::RegisterTargetMachine<llvm::X86_64TargetMachine>::Allocator(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) (TargetRegistry.h:1015)
==16286==    by 0x259B15C0: llvm::Target::createTargetMachine(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model) const (TargetRegistry.h:337)
==16286==    by 0x259B1478: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:90)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==    by 0x259B06DD: LLVMCreateJITCompilerForModule (ExecutionEngineBindings.cpp:129)
==16286==  Address 0x274ab540 is not stack'd, malloc'd or (recently) free'd
==16286== 
==16286== Invalid free() / delete / delete[] / realloc()
==16286==    at 0x4C2972C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16286==    by 0x20D438CF: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib/libstdc++.so.6.0.17)
==16286==    by 0x259B16AD: llvm::Triple::~Triple() (Triple.h:41)
==16286==    by 0x259B1498: llvm::EngineBuilder::selectTarget(llvm::Module*, llvm::StringRef, llvm::StringRef, llvm::SmallVectorImpl<std::string> const&, llvm::Reloc::Model, llvm::CodeModel::Model, std::string*) (TargetSelect.cpp:92)
==16286==    by 0x259A251A: llvm::EngineBuilder::create() (ExecutionEngine.cpp:470)
==16286==    by 0x259B06DD: LLVMCreateJITCompilerForModule (ExecutionEngineBindings.cpp:129)
==16286==    by 0x259B07E9: LLVMCreateJITCompiler (ExecutionEngineBindings.cpp:162)
==16286==    by 0x25933194: init_gallivm_state (lp_bld_init.c:257)
==16286==    by 0x259334EB: gallivm_create (lp_bld_init.c:429)
==16286==    by 0x2588BA00: draw_create_context (draw_context.c:82)
==16286==    by 0x2588BAA8: draw_create (draw_context.c:116)
==16286==    by 0x255B99DB: nv50_create (nv50_context.c:146)
==16286==  Address 0x274ab690 is not stack'd, malloc'd or (recently) free'd
Comment 5 Dave Airlie 2012-06-18 10:45:25 PDT
the C++ string stuff is calling operator delete, however it calls the delete from libstdc++, but operator new is pointing to the one from webkitgtk3.

I do wonder if its a bug in the linker but I have to find someone who knows how the linker should work first.
Comment 6 Dave Airlie 2012-06-18 10:51:23 PDT
LD_DEBUG=true gnome-control-center prints out a very long log (135MB here).

but in it you can see where it binds the mangled "operater new" _Znam to libwebkitgtk and the mangled "operator delete" _ZdlPv to libstdc++, as the symbols are lazily resolved. LD_BIND_NOW also works around it.

I've noticed the QT version avoids replacing  the global malloc so maybe the gtk version should do the same.
Comment 7 Xan Lopez 2012-06-18 11:20:12 PDT
(In reply to comment #6)
> I've noticed the QT version avoids replacing  the global malloc so maybe the gtk version should do the same.

Agreed here, I don't see any reason why we would want to do this. Just a matter of adding GTK to the global fastmalloc new thing in Platform.h I guess.
Comment 8 Gustavo Noronha (kov) 2012-06-18 11:47:35 PDT
Created attachment 148142 [details]
Patch
Comment 9 Gustavo Noronha (kov) 2012-06-18 11:51:27 PDT
Created attachment 148145 [details]
Patch
Comment 10 Martin Robinson 2012-06-19 08:21:28 PDT
Comment on attachment 148145 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=148145&action=review

> Source/WTF/wtf/Platform.h:778
> -#if PLATFORM(QT)
> -/* We must not customize the global operator new and delete for the Qt port. */
> +#if PLATFORM(QT) || PLATFORM(GTK)
>  #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
>  #if !OS(UNIX)
>  #define USE_SYSTEM_MALLOC 1

This also has the side effect of turning off TcMalloc for Windows...
Comment 11 Martin Robinson 2012-06-19 08:21:51 PDT
*** Bug 89469 has been marked as a duplicate of this bug. ***
Comment 12 Andy Wingo 2012-06-20 02:27:17 PDT
(In reply to comment #10)
 > Source/WTF/wtf/Platform.h:778
> > -#if PLATFORM(QT)
> > -/* We must not customize the global operator new and delete for the Qt port. */
> > +#if PLATFORM(QT) || PLATFORM(GTK)
> >  #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
> >  #if !OS(UNIX)
> >  #define USE_SYSTEM_MALLOC 1
> 
> This also has the side effect of turning off TcMalloc for Windows...

So that would be an r-, no?
Comment 13 Martin Robinson 2012-06-20 08:25:00 PDT
(In reply to comment #12)

> So that would be an r-, no?

I wasn't sure in this case if it was an accident or not.
Comment 14 Gustavo Noronha (kov) 2012-06-20 11:45:27 PDT
I assumed this would make sense for us if it makes sense for Qt. We can add a separate ifdef if it's not desirable, though.
Comment 15 Martin Robinson 2012-06-20 11:47:11 PDT
(In reply to comment #14)
> I assumed this would make sense for us if it makes sense for Qt. We can add a separate ifdef if it's not desirable, though.

It's probably safe either way, but perhaps for completeness it might be good to understand why Qt turns it off for Windows. Doesn't Safari use TCMalloc on Windows?
Comment 16 Martin Robinson 2012-06-20 12:22:39 PDT
(In reply to comment #15)

> It's probably safe either way, but perhaps for completeness it might be good to understand why Qt turns it off for Windows. Doesn't Safari use TCMalloc on Windows?

In fact, it might be best to only disable global new/delete override for GTK+ now and think about whether to disable TCMalloc completely for non-Unix platforms later.
Comment 17 Gustavo Noronha (kov) 2012-06-21 05:25:47 PDT
Created attachment 148772 [details]
Patch
Comment 18 Gustavo Noronha (kov) 2012-06-21 05:26:26 PDT
Sure, makes sense =)
Comment 19 Martin Robinson 2012-06-21 06:10:26 PDT
Comment on attachment 148772 [details]
Patch

Thanks!
Comment 20 Gustavo Noronha (kov) 2012-06-22 05:41:51 PDT
Committed r121018: <http://trac.webkit.org/changeset/121018>