Changeset 50204 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Oct 28, 2009, 3:14:35 AM (16 years ago)
Author:
[email protected]
Message:

Export fastMalloc, fastCalloc, fastRealloc and fastFree on GCC/Unix

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

When using -fvisibility=hidden to hide all internal symbols by default
the malloc symbols will be hidden as well. For memory instrumentation
it is needed to provide an instrumented version of these symbols and
override the normal routines and by changing the visibility back to
default this becomes possible.

The only other solution would be to use system malloc instead of the
TCmalloc implementation but this will not allow to analyze memory
behavior with the default allocator.

  • wtf/FastMalloc.h: Define WTF_FAST_MALLOC_EXPORT for GCC and !darwin
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.h

    r48976 r50204  
    2727#include <new>
    2828
     29#if COMPILER(GCC)
     30#define WTF_FAST_MALLOC_EXPORT __attribute__((visibility("default")))
     31#else
     32#define WTF_FAST_MALLOC_EXPORT
     33#endif
     34
    2935namespace WTF {
    3036
    3137    // These functions call CRASH() if an allocation fails.
    32     void* fastMalloc(size_t);
     38    void* fastMalloc(size_t) WTF_FAST_MALLOC_EXPORT;
    3339    void* fastZeroedMalloc(size_t);
    34     void* fastCalloc(size_t numElements, size_t elementSize);
    35     void* fastRealloc(void*, size_t);
     40    void* fastCalloc(size_t numElements, size_t elementSize) WTF_FAST_MALLOC_EXPORT;
     41    void* fastRealloc(void*, size_t) WTF_FAST_MALLOC_EXPORT;
    3642
    3743    struct TryMallocReturnValue {
     
    7278    TryMallocReturnValue tryFastRealloc(void* p, size_t n);
    7379
    74     void fastFree(void*);
     80    void fastFree(void*) WTF_FAST_MALLOC_EXPORT;
    7581
    7682#ifndef NDEBUG   
Note: See TracChangeset for help on using the changeset viewer.