dart-sdk/third_party/tcmalloc
Daco Harkes b1e59721d4 Revert "[vm] Remove tcmalloc and malloc profiler."
This reverts commit c67fac9cb4.

Reason for revert: Regresses `dart:io` performance and causes
failures.
https://github.com/dart-lang/sdk/issues/51639

Original change's description:
> [vm] Remove tcmalloc and malloc profiler.
>
> The standalone VM originally began statically linking tcmalloc to work around bugs in the system malloc for Fiber. Later it used tcmalloc's hooks to implement a profiler, but this is rarely used since it is only available in debug mode, misses early allocations, and often misses late allocations from an exhausted sample buffer. Removing it altogether avoids build complexity around which combinations of compiler/architecture/sysroot support tcmalloc, and reduces binary size.
>
> TEST=ci
> Change-Id: I4b259e18b82b2d12a2a60962aabf83bd8d997d19
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286120
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Change-Id: I4395edd6f5bd7e26b4e38f4d931ad2ea67afba18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286925
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-06 10:28:33 +00:00
..
include Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
.gitignore Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
BUILD.gn Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
configure_command Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
COPYING Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
OWNERS Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
README.dart Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00
tcmalloc_sources.gni Revert "[vm] Remove tcmalloc and malloc profiler." 2023-03-06 10:28:33 +00:00

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.

. Also copy the COPYING file and any other relevant licensing information.

. 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,
  and arm for Linux and any other OSs that are supported.