]>
git.saurik.com Git - apple/javascriptcore.git/blob - wtf/FastMalloc.h
1 // -*- mode: c++; c-basic-offset: 4 -*-
3 * This file is part of the KDE libraries
4 * Copyright (C) 2005 Apple Computer, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef WTF_FastMalloc_h
24 #define WTF_FastMalloc_h
32 void *fastMalloc(size_t n
);
33 void *fastZeroedMalloc(size_t n
);
34 void *fastCalloc(size_t n_elements
, size_t element_size
);
35 void fastFree(void* p
);
36 void *fastRealloc(void* p
, size_t n
);
39 void fastMallocForbid();
40 void fastMallocAllow();
45 using WTF::fastMalloc
;
46 using WTF::fastZeroedMalloc
;
47 using WTF::fastCalloc
;
48 using WTF::fastRealloc
;
52 using WTF::fastMallocForbid
;
53 using WTF::fastMallocAllow
;
56 #if COMPILER(GCC) && PLATFORM(DARWIN)
57 #define WTF_PRIVATE_INLINE __private_extern__ inline __attribute__((always_inline))
59 #define WTF_PRIVATE_INLINE inline __attribute__((always_inline))
61 #define WTF_PRIVATE_INLINE __forceinline
63 #define WTF_PRIVATE_INLINE inline
66 #ifndef _CRTDBG_MAP_ALLOC
68 #if !defined(USE_SYSTEM_MALLOC) || !(USE_SYSTEM_MALLOC)
69 WTF_PRIVATE_INLINE
void* operator new(size_t s
) { return fastMalloc(s
); }
70 WTF_PRIVATE_INLINE
void operator delete(void* p
) { fastFree(p
); }
71 WTF_PRIVATE_INLINE
void* operator new[](size_t s
) { return fastMalloc(s
); }
72 WTF_PRIVATE_INLINE
void operator delete[](void* p
) { fastFree(p
); }
75 void releaseFastMallocFreeMemory();
79 #endif // _CRTDBG_MAP_ALLOC
81 #endif /* WTF_FastMalloc_h */