Fix memory accounting when not using JEmalloc
commita68441208ef6cf45ffa13a5abba4a660b4a361d9
authorRick Lavoie <rlavoie@fb.com>
Sat, 12 Mar 2022 16:58:16 +0000 (12 08:58 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Sat, 12 Mar 2022 16:58:16 +0000 (12 08:58 -0800)
treed189fabbf6d695595224d82de1bbc1ae39ff9dc4
parent5f91cdfd8d811588d3972a02eeff438201d40a9a
Fix memory accounting when not using JEmalloc

Summary:
When not using JEmalloc (for example if we're compiling under ASAN),
we don't track memory usage, thus none of our OOM checks really work
(usage is always 0).

Instead of only using allocation counters when JEmalloc is enabled,
always use them. When using JEmalloc, the counters work as they did
before. When not using JEmalloc, we manually adjust the counters when
allocating and freeing.

Reviewed By: edwinsmith

Differential Revision: D34837790

fbshipit-source-id: 0d5ac319b9ac19ca70be2656abd94da1c6457f83
hphp/runtime/base/memory-manager-inl.h
hphp/runtime/base/memory-manager.cpp
hphp/runtime/base/memory-manager.h
hphp/runtime/base/sparse-heap.cpp
hphp/test/slow/memory/t113566137.php [new file with mode: 0644]
hphp/test/slow/memory/t113566137.php.expectf [new file with mode: 0644]
hphp/test/slow/memory/t113566137.php.opts [new file with mode: 0644]