mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:19:49 +00:00
Use tcmalloc on Linux
Statically linking in the tcmalloc code is enough to override the built-in malloc. I have this set up to exclude the code for collecting heap profiles in a Product build. There's still about a 230KB increase in binary size, though. I think this isn't a big problem since right now this is enabled only for server Linux. product binary size: before x64: 9569600 after x64: 9807840 increase: 238240 (2.5%) before ia32: 9122836 after ia32: 9360944 increase: 238108 (2.6%) before mips: 9418680 after mips: 9640940 increase: 222260 (2.4%) InitialRSS: product: before x64: 6307840 after x64: 7430144 increase: 1122304 (17.8%) release (--no-profiler) before x64: 7843840 after x64: 9207808 increase: 1363968 (17.4%) R=asiva@google.com, whesse@google.com Review URL: https://codereview.chromium.org/2316813002 .
This commit is contained in:
parent
22040876bf
commit
44a04f18f9
6
DEPS
6
DEPS
|
@ -34,6 +34,8 @@ vars = {
|
|||
"base_revision": "@672b04e54b937ec899429a6bd5409c5a6300d151",
|
||||
"buildtools_revision": "@565d04e8741429fb1b4f26d102f2c6c3b849edeb",
|
||||
|
||||
"gperftools_revision": "@7822b5b0b9fa7e016e1f6b46ea86f26f4691a457",
|
||||
|
||||
# Revisions of /third_party/* dependencies.
|
||||
"args_tag": "@0.13.5",
|
||||
"async_tag": "@1.11.1",
|
||||
|
@ -167,6 +169,10 @@ deps = {
|
|||
Var("dart_root") + "/third_party/WebCore":
|
||||
"https://github.com/dart-lang/webcore.git" + Var("WebCore_rev"),
|
||||
|
||||
Var("dart_root") + "/third_party/tcmalloc/gperftools":
|
||||
Var('chromium_git') + '/external/github.com/gperftools/gperftools.git' +
|
||||
Var("gperftools_revision"),
|
||||
|
||||
Var("dart_root") + "/third_party/pkg/args":
|
||||
(Var("github_mirror") % "args") + Var("args_tag"),
|
||||
Var("dart_root") + "/third_party/pkg/async":
|
||||
|
|
|
@ -1147,6 +1147,11 @@
|
|||
},
|
||||
},
|
||||
}],
|
||||
['OS == "linux" and asan == 0', {
|
||||
'dependencies': [
|
||||
'../third_party/tcmalloc/tcmalloc.gypi:tcmalloc',
|
||||
],
|
||||
}],
|
||||
],
|
||||
'configurations': {
|
||||
'Dart_Linux_Base': {
|
||||
|
@ -1393,6 +1398,11 @@
|
|||
'libraries': [ '-lws2_32.lib', '-lRpcrt4.lib', '-lwinmm.lib' ],
|
||||
},
|
||||
}],
|
||||
['OS == "linux" and asan == 0', {
|
||||
'dependencies': [
|
||||
'../third_party/tcmalloc/tcmalloc.gypi:tcmalloc',
|
||||
],
|
||||
}],
|
||||
],
|
||||
'configurations': {
|
||||
'Dart_Linux_Base': {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
# then do not build the native libraries supporting dart:io.
|
||||
'dart_io_support%': 0,
|
||||
'dart_io_secure_socket%': 1,
|
||||
'asan%': 0,
|
||||
# Intel VTune related variables.
|
||||
'dart_vtune_support%': 0,
|
||||
'conditions': [
|
||||
|
|
1
third_party/.gitignore
vendored
1
third_party/.gitignore
vendored
|
@ -6,6 +6,7 @@
|
|||
!pkg
|
||||
!pkg_tested
|
||||
!/boringssl
|
||||
!/tcmalloc
|
||||
!drt_resources
|
||||
!d8
|
||||
!7zip.tar.gz.sha1
|
||||
|
|
3
third_party/tcmalloc/.gitignore
vendored
Normal file
3
third_party/tcmalloc/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.mk
|
||||
*.Makefile
|
||||
/gperftools
|
23
third_party/tcmalloc/README.dart
vendored
Normal file
23
third_party/tcmalloc/README.dart
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
Dart uses tcmalloc in the standalone VM on Linux.
|
||||
|
||||
To roll tcmalloc forward:
|
||||
. Clone the gperftools git repo at the revision you want in a directory off
|
||||
to the side.
|
||||
|
||||
. Run a configure command similar to the one in the configure_command file in
|
||||
this directory. It is up to you to determine if different flags are required
|
||||
for the newer gperftools.
|
||||
|
||||
. From that repo, copy src/config.h and src/gperftools/tcmalloc.h, and any other
|
||||
generated header files to the include/ directory in this directory.
|
||||
|
||||
. Make sure that include/config.h defines HAVE_UCONTEXT_H on Linux,
|
||||
|
||||
. Update tcmalloc_sources.gypi, and tcmalloc.gyp if necessary. This may require
|
||||
inspecting gperftools/Makefile.am to see any additional source files and
|
||||
preprocessor defines (-D flags).
|
||||
|
||||
. Update the DEPS file with the new git hash.
|
||||
|
||||
. Build and run tests for Debug, Release, and Product builds for ia32, x64, mips
|
||||
and arm for Linux and any other OSs that are supported.
|
1
third_party/tcmalloc/configure_command
vendored
Normal file
1
third_party/tcmalloc/configure_command
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
./configure --enable-emergency-malloc --enable-frame-pointers --disable-cpu-profiler --disable-heap-checker --disable-debugalloc --enable-sized-delete --disable-libunwind
|
308
third_party/tcmalloc/include/config.h
vendored
Normal file
308
third_party/tcmalloc/include/config.h
vendored
Normal file
|
@ -0,0 +1,308 @@
|
|||
/* src/config.h. Generated from config.h.in by configure. */
|
||||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
|
||||
#ifndef GPERFTOOLS_CONFIG_H_
|
||||
#define GPERFTOOLS_CONFIG_H_
|
||||
|
||||
|
||||
/* Build runtime detection for sized delete */
|
||||
/* #undef ENABLE_DYNAMIC_SIZED_DELETE */
|
||||
|
||||
/* Build sized deletion operators */
|
||||
#define ENABLE_SIZED_DELETE 1
|
||||
|
||||
/* Define to 1 if compiler supports __builtin_expect */
|
||||
#define HAVE_BUILTIN_EXPECT 1
|
||||
|
||||
/* Define to 1 if compiler supports __builtin_stack_pointer */
|
||||
/* #undef HAVE_BUILTIN_STACK_POINTER */
|
||||
|
||||
/* Define to 1 if you have the <conflict-signal.h> header file. */
|
||||
/* #undef HAVE_CONFLICT_SIGNAL_H */
|
||||
|
||||
/* Define to 1 if you have the <cygwin/signal.h> header file. */
|
||||
/* #undef HAVE_CYGWIN_SIGNAL_H */
|
||||
|
||||
/* Define to 1 if you have the declaration of `backtrace', and to 0 if you
|
||||
don't. */
|
||||
/* #undef HAVE_DECL_BACKTRACE */
|
||||
|
||||
/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_CFREE 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `memalign', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_MEMALIGN 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `nanosleep', and to 0 if you
|
||||
don't. */
|
||||
/* #undef HAVE_DECL_NANOSLEEP */
|
||||
|
||||
/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if
|
||||
you don't. */
|
||||
#define HAVE_DECL_POSIX_MEMALIGN 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_PVALLOC 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `sleep', and to 0 if you don't.
|
||||
*/
|
||||
/* #undef HAVE_DECL_SLEEP */
|
||||
|
||||
/* Define to 1 if you have the declaration of `uname', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_UNAME 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_VALLOC 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if the system has the type `Elf32_Versym'. */
|
||||
#define HAVE_ELF32_VERSYM 1
|
||||
|
||||
/* Define to 1 if you have the <execinfo.h> header file. */
|
||||
#define HAVE_EXECINFO_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <features.h> header file. */
|
||||
#define HAVE_FEATURES_H 1
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#define HAVE_FORK 1
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#define HAVE_GETEUID 1
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#define HAVE_GETPAGESIZE 1
|
||||
|
||||
/* Define to 1 if you have the <glob.h> header file. */
|
||||
#define HAVE_GLOB_H 1
|
||||
|
||||
/* Define to 1 if you have the <grp.h> header file. */
|
||||
#define HAVE_GRP_H 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <libunwind.h> header file. */
|
||||
/* #undef HAVE_LIBUNWIND_H */
|
||||
|
||||
/* Define to 1 if you have the <linux/ptrace.h> header file. */
|
||||
#define HAVE_LINUX_PTRACE_H 1
|
||||
|
||||
/* Define if this is Linux that has SIGEV_THREAD_ID */
|
||||
#define HAVE_LINUX_SIGEV_THREAD_ID 1
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* define if the compiler implements namespaces */
|
||||
#define HAVE_NAMESPACES 1
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#define HAVE_POLL_H 1
|
||||
|
||||
/* define if libc has program_invocation_name */
|
||||
#define HAVE_PROGRAM_INVOCATION_NAME 1
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#define HAVE_PTHREAD 1
|
||||
|
||||
/* defined to 1 if pthread symbols are exposed even without include pthread.h
|
||||
*/
|
||||
/* #undef HAVE_PTHREAD_DESPITE_ASKING_FOR */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Define to 1 if you have the `sbrk' function. */
|
||||
#define HAVE_SBRK 1
|
||||
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
#define HAVE_SCHED_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if the system has the type `struct mallinfo'. */
|
||||
#define HAVE_STRUCT_MALLINFO 1
|
||||
|
||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
#define HAVE_SYS_CDEFS_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||
#define HAVE_SYS_PRCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/syscall.h> header file. */
|
||||
#define HAVE_SYS_SYSCALL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ucontext.h> header file. */
|
||||
#undef HAVE_SYS_UCONTEXT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if compiler supports __thread */
|
||||
#define HAVE_TLS 1
|
||||
|
||||
/* Define to 1 if you have the <ucontext.h> header file. */
|
||||
#define HAVE_UCONTEXT_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Whether <unwind.h> contains _Unwind_Backtrace */
|
||||
#define HAVE_UNWIND_BACKTRACE 1
|
||||
|
||||
/* Define to 1 if you have the <unwind.h> header file. */
|
||||
#define HAVE_UNWIND_H 1
|
||||
|
||||
/* Define to 1 if you have the <valgrind.h> header file. */
|
||||
/* #undef HAVE_VALGRIND_H */
|
||||
|
||||
/* define if your compiler has __attribute__ */
|
||||
#define HAVE___ATTRIBUTE__ 1
|
||||
|
||||
/* Define to 1 if compiler supports __environ */
|
||||
#define HAVE___ENVIRON 1
|
||||
|
||||
/* Define to 1 if the system has the type `__int64'. */
|
||||
/* #undef HAVE___INT64 */
|
||||
|
||||
/* prefix where we look for installed files */
|
||||
#define INSTALL_PREFIX "/usr/local"
|
||||
|
||||
/* Define to 1 if int32_t is equivalent to intptr_t */
|
||||
/* #undef INT32_EQUALS_INTPTR */
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define to 'volatile' if __malloc_hook is declared volatile */
|
||||
#define MALLOC_HOOK_MAYBE_VOLATILE volatile
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "gperftools"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "gperftools@googlegroups.com"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "gperftools"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "gperftools 2.5"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "gperftools"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "2.5"
|
||||
|
||||
/* How to access the PC from a struct ucontext */
|
||||
/* #undef PC_FROM_UCONTEXT */
|
||||
|
||||
/* Always the empty-string on non-windows systems. On windows, should be
|
||||
"__declspec(dllexport)". This way, when we compile the dll, we export our
|
||||
functions/classes. It's safe to define this here because config.h is only
|
||||
used internally, to compile the DLL, and every DLL source file #includes
|
||||
"config.h" before anything else. */
|
||||
#define PERFTOOLS_DLL_DECL /**/
|
||||
|
||||
/* printf format code for printing a size_t and ssize_t */
|
||||
#define PRIdS "ld"
|
||||
|
||||
/* printf format code for printing a size_t and ssize_t */
|
||||
#define PRIuS "lu"
|
||||
|
||||
/* printf format code for printing a size_t and ssize_t */
|
||||
#define PRIxS "lx"
|
||||
|
||||
/* Mark the systems where we know it's bad if pthreads runs too
|
||||
early before main (before threads are initialized, presumably). */
|
||||
#ifdef __FreeBSD__
|
||||
#define PTHREADS_CRASHES_IF_RUN_TOO_EARLY 1
|
||||
#endif
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
/* #undef PTHREAD_CREATE_JOINABLE */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* the namespace where STL code like vector<> is defined */
|
||||
#define STL_NAMESPACE std
|
||||
|
||||
/* Define 32K of internal pages size for tcmalloc */
|
||||
/* #undef TCMALLOC_32K_PAGES */
|
||||
|
||||
/* Define 64K of internal pages size for tcmalloc */
|
||||
/* #undef TCMALLOC_64K_PAGES */
|
||||
|
||||
/* Define 8 bytes of allocation alignment for tcmalloc */
|
||||
/* #undef TCMALLOC_ALIGN_8BYTES */
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.5"
|
||||
|
||||
/* C99 says: define this to get the PRI... macros from stdint.h */
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
# define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include "windows/mingw.h"
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef GPERFTOOLS_CONFIG_H_ */
|
147
third_party/tcmalloc/include/gperftools/tcmalloc.h
vendored
Normal file
147
third_party/tcmalloc/include/gperftools/tcmalloc.h
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
// -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*-
|
||||
/* Copyright (c) 2003, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ---
|
||||
* Author: Sanjay Ghemawat <opensource@google.com>
|
||||
* .h file by Craig Silverstein <opensource@google.com>
|
||||
*/
|
||||
|
||||
#ifndef TCMALLOC_TCMALLOC_H_
|
||||
#define TCMALLOC_TCMALLOC_H_
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
|
||||
/* Define the version number so folks can check against it */
|
||||
#define TC_VERSION_MAJOR 2
|
||||
#define TC_VERSION_MINOR 5
|
||||
#define TC_VERSION_PATCH ""
|
||||
#define TC_VERSION_STRING "gperftools 2.5"
|
||||
|
||||
/* For struct mallinfo, if it's defined. */
|
||||
#if 1
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define PERFTOOLS_THROW throw()
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# define PERFTOOLS_THROW __attribute__((__nothrow__))
|
||||
# else
|
||||
# define PERFTOOLS_THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef PERFTOOLS_DLL_DECL
|
||||
#define PERFTOOLS_DLL_DECL_DEFINED
|
||||
# ifdef _WIN32
|
||||
# define PERFTOOLS_DLL_DECL __declspec(dllimport)
|
||||
# else
|
||||
# define PERFTOOLS_DLL_DECL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace std {
|
||||
struct nothrow_t;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Returns a human-readable version string. If major, minor,
|
||||
* and/or patch are not NULL, they are set to the major version,
|
||||
* minor version, and patch-code (a string, usually "").
|
||||
*/
|
||||
PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor,
|
||||
const char** patch) PERFTOOLS_THROW;
|
||||
|
||||
PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_malloc_skip_new_handler(size_t size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_free(void* ptr) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_free_sized(void *ptr, size_t size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_realloc(void* ptr, size_t size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_calloc(size_t nmemb, size_t size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) PERFTOOLS_THROW;
|
||||
|
||||
PERFTOOLS_DLL_DECL void* tc_memalign(size_t __alignment,
|
||||
size_t __size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL int tc_posix_memalign(void** ptr,
|
||||
size_t align, size_t size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) PERFTOOLS_THROW;
|
||||
|
||||
PERFTOOLS_DLL_DECL void tc_malloc_stats(void) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) PERFTOOLS_THROW;
|
||||
#if 1
|
||||
PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) PERFTOOLS_THROW;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is an alias for MallocExtension::instance()->GetAllocatedSize().
|
||||
* It is equivalent to
|
||||
* OS X: malloc_size()
|
||||
* glibc: malloc_usable_size()
|
||||
* Windows: _msize()
|
||||
*/
|
||||
PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) PERFTOOLS_THROW;
|
||||
|
||||
#ifdef __cplusplus
|
||||
PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_new(size_t size);
|
||||
PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size,
|
||||
const std::nothrow_t&) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_delete(void* p) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_delete_sized(void* p, size_t size) throw();
|
||||
PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p,
|
||||
const std::nothrow_t&) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void* tc_newarray(size_t size);
|
||||
PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size,
|
||||
const std::nothrow_t&) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray(void* p) PERFTOOLS_THROW;
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_sized(void* p, size_t size) throw();
|
||||
PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p,
|
||||
const std::nothrow_t&) PERFTOOLS_THROW;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We're only un-defining those for public */
|
||||
#if !defined(GPERFTOOLS_CONFIG_H_)
|
||||
|
||||
#undef PERFTOOLS_THROW
|
||||
|
||||
#ifdef PERFTOOLS_DLL_DECL_DEFINED
|
||||
#undef PERFTOOLS_DLL_DECL
|
||||
#undef PERFTOOLS_DLL_DECL_DEFINED
|
||||
#endif
|
||||
|
||||
#endif /* GPERFTOOLS_CONFIG_H_ */
|
||||
|
||||
#endif /* #ifndef TCMALLOC_TCMALLOC_H_ */
|
104
third_party/tcmalloc/tcmalloc.gypi
vendored
Normal file
104
third_party/tcmalloc/tcmalloc.gypi
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'dynamic_annotations',
|
||||
'type': 'static_library',
|
||||
'toolsets': ['host', 'target'],
|
||||
'include_dirs': [
|
||||
'include',
|
||||
'gperftools/src/base',
|
||||
'gperftools/src',
|
||||
],
|
||||
'cflags!': [
|
||||
'-Werror',
|
||||
'-Wnon-virtual-dtor',
|
||||
'-Woverloaded-virtual',
|
||||
'-fno-rtti',
|
||||
],
|
||||
'sources': [
|
||||
'gperftools/src/base/dynamic_annotations.c',
|
||||
'gperftools/src/base/dynamic_annotations.h',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'tcmalloc',
|
||||
'type': 'static_library',
|
||||
'toolsets': ['host', 'target'],
|
||||
'dependencies': [
|
||||
'dynamic_annotations',
|
||||
],
|
||||
'include_dirs': [
|
||||
'include',
|
||||
'gperftools/src/base',
|
||||
'gperftools/src',
|
||||
],
|
||||
'includes': [
|
||||
'tcmalloc_sources.gypi',
|
||||
],
|
||||
# Disable the heap checker in tcmalloc.
|
||||
'defines': [
|
||||
'ENABLE_EMERGENCY_MALLOC',
|
||||
'NO_HEAP_CHECK',
|
||||
# Disable debug even in a Dart Debug build. It is too slow.
|
||||
'NDEBUG',
|
||||
],
|
||||
'defines!': [
|
||||
# Disable debug even in a Dart Debug build. It is too slow.
|
||||
'DEBUG',
|
||||
],
|
||||
'cflags': [
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-sign-compare',
|
||||
'-Wno-type-limits',
|
||||
'-Wno-unused-result',
|
||||
'-Wno-vla',
|
||||
'-fno-builtin-malloc',
|
||||
'-fno-builtin-free',
|
||||
'-fno-builtin-realloc',
|
||||
'-fno-builtin-calloc',
|
||||
'-fno-builtin-cfree',
|
||||
'-fno-builtin-memalign',
|
||||
'-fno-builtin-posix_memalign',
|
||||
'-fno-builtin-valloc',
|
||||
'-fno-builtin-pvalloc',
|
||||
],
|
||||
'cflags!': [
|
||||
'-Werror',
|
||||
'-Wvla',
|
||||
],
|
||||
'link_settings': {
|
||||
'ldflags': [
|
||||
# Don't let linker rip this symbol out, otherwise the heap&cpu
|
||||
# profilers will not initialize properly on startup.
|
||||
'-Wl,-uIsHeapProfilerRunning,-uProfilerStart',
|
||||
],
|
||||
},
|
||||
'sources!': [
|
||||
# No debug allocator.
|
||||
'gperftools/src/debugallocation.cc',
|
||||
# Not needed when using emergency malloc.
|
||||
'gperftools/src/fake_stacktrace_scope.cc',
|
||||
# Not using the cpuprofiler
|
||||
'gperftools/src/base/thread_lister.c',
|
||||
'gperftools/src/base/thread_lister.h',
|
||||
'gperftools/src/profile-handler.cc',
|
||||
'gperftools/src/profile-handler.h',
|
||||
'gperftools/src/profiledata.cc',
|
||||
'gperftools/src/profiledata.h',
|
||||
'gperftools/src/profiler.cc',
|
||||
],
|
||||
# Disable sample collection in Release and Product builds.
|
||||
'configurations': {
|
||||
'Dart_Product': {
|
||||
'defines': [
|
||||
'NO_TCMALLOC_SAMPLES',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
161
third_party/tcmalloc/tcmalloc_sources.gypi
vendored
Normal file
161
third_party/tcmalloc/tcmalloc_sources.gypi
vendored
Normal file
|
@ -0,0 +1,161 @@
|
|||
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
{
|
||||
'sources': [
|
||||
# gperftools/src/
|
||||
'gperftools/src/addressmap-inl.h',
|
||||
'gperftools/src/central_freelist.cc',
|
||||
'gperftools/src/central_freelist.h',
|
||||
'gperftools/src/common.cc',
|
||||
'gperftools/src/common.h',
|
||||
'gperftools/src/config_for_unittests.h',
|
||||
'gperftools/src/config.h',
|
||||
'gperftools/src/config.h.in',
|
||||
'gperftools/src/debugallocation.cc',
|
||||
'gperftools/src/emergency_malloc.cc',
|
||||
'gperftools/src/emergency_malloc_for_stacktrace.cc',
|
||||
'gperftools/src/emergency_malloc.h',
|
||||
'gperftools/src/fake_stacktrace_scope.cc',
|
||||
'gperftools/src/getenv_safe.h',
|
||||
'gperftools/src/getpc.h',
|
||||
'gperftools/src/heap-checker-bcad.cc',
|
||||
'gperftools/src/heap-checker.cc',
|
||||
'gperftools/src/heap-profiler.cc',
|
||||
'gperftools/src/heap-profile-stats.h',
|
||||
'gperftools/src/heap-profile-table.cc',
|
||||
'gperftools/src/heap-profile-table.h',
|
||||
'gperftools/src/internal_logging.cc',
|
||||
'gperftools/src/internal_logging.h',
|
||||
'gperftools/src/libc_override_gcc_and_weak.h',
|
||||
'gperftools/src/libc_override_glibc.h',
|
||||
'gperftools/src/libc_override.h',
|
||||
'gperftools/src/libc_override_osx.h',
|
||||
'gperftools/src/libc_override_redefine.h',
|
||||
'gperftools/src/linked_list.h',
|
||||
'gperftools/src/malloc_extension.cc',
|
||||
'gperftools/src/malloc_hook.cc',
|
||||
'gperftools/src/malloc_hook-inl.h',
|
||||
'gperftools/src/malloc_hook_mmap_freebsd.h',
|
||||
'gperftools/src/malloc_hook_mmap_linux.h',
|
||||
'gperftools/src/maybe_emergency_malloc.h',
|
||||
'gperftools/src/maybe_threads.cc',
|
||||
'gperftools/src/maybe_threads.h',
|
||||
'gperftools/src/memfs_malloc.cc',
|
||||
'gperftools/src/memory_region_map.cc',
|
||||
'gperftools/src/memory_region_map.h',
|
||||
'gperftools/src/packed-cache-inl.h',
|
||||
'gperftools/src/page_heap_allocator.h',
|
||||
'gperftools/src/page_heap.cc',
|
||||
'gperftools/src/page_heap.h',
|
||||
'gperftools/src/pagemap.h',
|
||||
'gperftools/src/profiledata.cc',
|
||||
'gperftools/src/profiledata.h',
|
||||
'gperftools/src/profile-handler.cc',
|
||||
'gperftools/src/profile-handler.h',
|
||||
'gperftools/src/profiler.cc',
|
||||
'gperftools/src/raw_printer.cc',
|
||||
'gperftools/src/raw_printer.h',
|
||||
'gperftools/src/sampler.cc',
|
||||
'gperftools/src/sampler.h',
|
||||
'gperftools/src/span.cc',
|
||||
'gperftools/src/span.h',
|
||||
'gperftools/src/stacktrace_arm-inl.h',
|
||||
'gperftools/src/stacktrace.cc',
|
||||
'gperftools/src/stacktrace_generic-inl.h',
|
||||
'gperftools/src/stacktrace_impl_setup-inl.h',
|
||||
'gperftools/src/stacktrace_instrument-inl.h',
|
||||
'gperftools/src/stacktrace_libgcc-inl.h',
|
||||
'gperftools/src/stacktrace_libunwind-inl.h',
|
||||
'gperftools/src/stacktrace_powerpc-darwin-inl.h',
|
||||
'gperftools/src/stacktrace_powerpc-inl.h',
|
||||
'gperftools/src/stacktrace_powerpc-linux-inl.h',
|
||||
'gperftools/src/stack_trace_table.cc',
|
||||
'gperftools/src/stack_trace_table.h',
|
||||
'gperftools/src/stacktrace_win32-inl.h',
|
||||
'gperftools/src/stacktrace_x86-inl.h',
|
||||
'gperftools/src/static_vars.cc',
|
||||
'gperftools/src/static_vars.h',
|
||||
'gperftools/src/symbolize.cc',
|
||||
'gperftools/src/symbolize.h',
|
||||
'gperftools/src/system-alloc.cc',
|
||||
'gperftools/src/system-alloc.h',
|
||||
'gperftools/src/tcmalloc.cc',
|
||||
'gperftools/src/tcmalloc_guard.h',
|
||||
'gperftools/src/tcmalloc.h',
|
||||
'gperftools/src/thread_cache.cc',
|
||||
'gperftools/src/thread_cache.h',
|
||||
|
||||
# gperftools/src/base/
|
||||
'gperftools/src/base/arm_instruction_set_select.h',
|
||||
'gperftools/src/base/atomicops.h',
|
||||
'gperftools/src/base/atomicops-internals-arm-generic.h',
|
||||
'gperftools/src/base/atomicops-internals-arm-v6plus.h',
|
||||
'gperftools/src/base/atomicops-internals-gcc.h',
|
||||
'gperftools/src/base/atomicops-internals-linuxppc.h',
|
||||
'gperftools/src/base/atomicops-internals-macosx.h',
|
||||
'gperftools/src/base/atomicops-internals-mips.h',
|
||||
'gperftools/src/base/atomicops-internals-windows.h',
|
||||
'gperftools/src/base/atomicops-internals-x86.cc',
|
||||
'gperftools/src/base/atomicops-internals-x86.h',
|
||||
'gperftools/src/base/basictypes.h',
|
||||
'gperftools/src/base/commandlineflags.h',
|
||||
# This C files is compiled into a separate target.
|
||||
# 'gperftools/src/base/dynamic_annotations.c',
|
||||
# 'gperftools/src/base/dynamic_annotations.h',
|
||||
'gperftools/src/base/elfcore.h',
|
||||
'gperftools/src/base/elf_mem_image.cc',
|
||||
'gperftools/src/base/elf_mem_image.h',
|
||||
'gperftools/src/base/googleinit.h',
|
||||
'gperftools/src/base/linux_syscall_support.h',
|
||||
'gperftools/src/base/linuxthreads.cc',
|
||||
'gperftools/src/base/linuxthreads.h',
|
||||
'gperftools/src/base/logging.cc',
|
||||
'gperftools/src/base/logging.h',
|
||||
'gperftools/src/base/low_level_alloc.cc',
|
||||
'gperftools/src/base/low_level_alloc.h',
|
||||
'gperftools/src/base/simple_mutex.h',
|
||||
'gperftools/src/base/spinlock.cc',
|
||||
'gperftools/src/base/spinlock.h',
|
||||
'gperftools/src/base/spinlock_internal.cc',
|
||||
'gperftools/src/base/spinlock_internal.h',
|
||||
'gperftools/src/base/spinlock_linux-inl.h',
|
||||
'gperftools/src/base/spinlock_posix-inl.h',
|
||||
'gperftools/src/base/spinlock_win32-inl.h',
|
||||
'gperftools/src/base/stl_allocator.h',
|
||||
'gperftools/src/base/sysinfo.cc',
|
||||
'gperftools/src/base/sysinfo.h',
|
||||
'gperftools/src/base/thread_annotations.h',
|
||||
'gperftools/src/base/thread_lister.c',
|
||||
'gperftools/src/base/thread_lister.h',
|
||||
'gperftools/src/base/vdso_support.cc',
|
||||
'gperftools/src/base/vdso_support.h',
|
||||
|
||||
# gperftools/src/google/
|
||||
'gperftools/src/google/heap-checker.h',
|
||||
'gperftools/src/google/heap-profiler.h',
|
||||
'gperftools/src/google/malloc_extension_c.h',
|
||||
'gperftools/src/google/malloc_extension.h',
|
||||
'gperftools/src/google/malloc_hook_c.h',
|
||||
'gperftools/src/google/malloc_hook.h',
|
||||
'gperftools/src/google/profiler.h',
|
||||
'gperftools/src/google/stacktrace.h',
|
||||
'gperftools/src/google/tcmalloc.h',
|
||||
|
||||
# gperftools/src/gperftools/
|
||||
'gperftools/src/gperftools/heap-checker.h',
|
||||
'gperftools/src/gperftools/heap-profiler.h',
|
||||
'gperftools/src/gperftools/malloc_extension_c.h',
|
||||
'gperftools/src/gperftools/malloc_extension.h',
|
||||
'gperftools/src/gperftools/malloc_hook_c.h',
|
||||
'gperftools/src/gperftools/malloc_hook.h',
|
||||
'gperftools/src/gperftools/profiler.h',
|
||||
'gperftools/src/gperftools/stacktrace.h',
|
||||
'gperftools/src/gperftools/tcmalloc.h',
|
||||
'gperftools/src/gperftools/tcmalloc.h.in',
|
||||
|
||||
# gperftools/src/third_party/
|
||||
'gperftools/src/third_party/valgrind.h',
|
||||
],
|
||||
}
|
|
@ -12,6 +12,8 @@
|
|||
'target_arch': 'ia32',
|
||||
# Flag that tells us whether to build native support for dart:io.
|
||||
'dart_io_support': 1,
|
||||
# Flag that tells us whether this is an ASAN build.
|
||||
'asan%': 0,
|
||||
},
|
||||
'conditions': [
|
||||
[ 'OS=="linux"', {
|
||||
|
|
|
@ -680,6 +680,7 @@
|
|||
'Dart_Base', 'Dart_mips_Base', 'Dart_Debug',
|
||||
'Dart_Linux_Base',
|
||||
'Dart_Linux_xmips_Base',
|
||||
'Dart_Linux_xmips_Debug',
|
||||
'Dart_Linux_Debug',
|
||||
],
|
||||
},
|
||||
|
@ -689,6 +690,7 @@
|
|||
'Dart_Base', 'Dart_mips_Base', 'Dart_Release',
|
||||
'Dart_Linux_Base',
|
||||
'Dart_Linux_xmips_Base',
|
||||
'Dart_Linux_xmips_Release',
|
||||
'Dart_Linux_Release',
|
||||
],
|
||||
},
|
||||
|
|
|
@ -299,6 +299,40 @@
|
|||
}]]
|
||||
},
|
||||
|
||||
# These flags are needed for tcmalloc to be able to collect stack traces
|
||||
# for heap profiling on mips.
|
||||
'Dart_Linux_xmips_Debug': {
|
||||
'abstract': 1,
|
||||
'target_conditions': [
|
||||
['_toolset=="target"', {
|
||||
'cflags!': [
|
||||
'-fno-exceptions',
|
||||
],
|
||||
'cflags': [
|
||||
'-fexceptions',
|
||||
'-funwind-tables',
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
||||
# These flags are needed for tcmalloc to be able to collect stack traces
|
||||
# for heap profiling on mips.
|
||||
'Dart_Linux_xmips_Release': {
|
||||
'abstract': 1,
|
||||
'target_conditions': [
|
||||
['_toolset=="target"', {
|
||||
'cflags!': [
|
||||
'-fno-exceptions',
|
||||
],
|
||||
'cflags': [
|
||||
'-fexceptions',
|
||||
'-funwind-tables',
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
|
||||
# MIPS native build
|
||||
'Dart_Linux_mips_Base': {
|
||||
'abstract': 1,
|
||||
|
|
Loading…
Reference in a new issue