tcmalloc: add run-time CHECK to smoke-test allocator overrides

Original CL:


  Add run-time CHECK to smoke-test allocator overrides

  As part of the refactoring work on the allocator, it emerged that it
  would be nice to have a test that ensures that we don't accidentally
  break things along the way and not detected that.
  This CL adds a runtime CHECK() that verifies that:
   - On Windows (non-component build) the shim layer has been
     initialized. Concretely this checks that chrome called the shimmed
     _heap_init() method and not the one from libcmt.
   - On Linux desktop, the malloc symbols are being overridden by
     tcmalloc (only when USE_TCMALLOC is defined).

  The rationale of this test is: if _heap_init was shimmed there are
  very good chances that malloc (& friends) were shimmed as well.
  Likewise on Linux for mallopt() <-> malloc().

  Cr-Commit-Position: refs/heads/master@{#369007}


Change-Id: I047ac19bb71346fbf601825d335bd97729b9f688
Commit-Queue: Gabriel Marin <>
Reviewed-by: Will Harris <>
Cr-Original-Commit-Position: refs/heads/master@{#585633}
Cr-Mirrored-Commit: 748aa79fbcb880ab33b2dcaef0c0a6274a934789
2 files changed
tree: 180d9bfa820a745d9f0cec2e8a80a5e61f54c921
  1. src/