Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions tcmalloc/central_freelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ class CentralFreeList {
size_t OverheadBytes();

// My size class.
size_t size_class() const {
return size_class_;
}
size_t size_class() const { return size_class_; }

SpanStats GetSpanStats() const;

Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/central_freelist_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#include <algorithm>

#include "absl/random/random.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/random/random.h"
#include "tcmalloc/common.h"
#include "tcmalloc/static_vars.h"

Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class SizeMap {
public:
// Constructor should do nothing since we rely on explicit Init()
// call, which may or may not be called before the constructor runs.
SizeMap() { }
SizeMap() {}

// Initialize the mapping arrays
void Init();
Expand Down
4 changes: 1 addition & 3 deletions tcmalloc/cpu_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,7 @@ static void ActivatePerCPUCaches() {

class PerCPUInitializer {
public:
PerCPUInitializer() {
ActivatePerCPUCaches();
}
PerCPUInitializer() { ActivatePerCPUCaches(); }
};
static PerCPUInitializer module_enter_exit;

Expand Down
3 changes: 1 addition & 2 deletions tcmalloc/cpu_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

namespace tcmalloc {


class CPUCache {
public:
enum class ActivationMode {
Expand Down Expand Up @@ -258,5 +257,5 @@ inline bool UsePerCpuCache() {
return false;
}

}; // namespace tcmalloc
}; // namespace tcmalloc
#endif // TCMALLOC_CPU_CACHE_H_
4 changes: 1 addition & 3 deletions tcmalloc/guarded_page_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ static void RecordTestFailure(absl::string_view error) {
//
// error contains the type of error to record.
static void RecordCrash(absl::string_view error) {

RecordBazelWarning(error);
RecordTestFailure(error);
}
Expand Down Expand Up @@ -461,8 +460,7 @@ static void SegvHandler(int signo, siginfo_t *info, void *context) {
std::tie(offset, size) =
Static::guardedpage_allocator().GetAllocationOffsetAndSize(fault);

Log(kLog, __FILE__, __LINE__,
"*** GWP-ASan has detected a memory error ***");
Log(kLog, __FILE__, __LINE__, "*** GWP-ASan has detected a memory error ***");
Log(kLog, __FILE__, __LINE__, ">>> Access at offset", offset,
"into buffer of length", size);
Log(kLog, __FILE__, __LINE__,
Expand Down
5 changes: 2 additions & 3 deletions tcmalloc/guarded_page_allocator_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "tcmalloc/guarded_page_allocator.h"

#include <unistd.h>

#include "benchmark/benchmark.h"
#include "absl/base/internal/spinlock.h"
#include "benchmark/benchmark.h"
#include "tcmalloc/guarded_page_allocator.h"
#include "tcmalloc/internal/logging.h"

namespace tcmalloc {
Expand Down
4 changes: 2 additions & 2 deletions tcmalloc/guarded_page_allocator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
#include <thread> // NOLINT(build/c++11)
#include <vector>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/spinlock.h"
#include "absl/base/internal/sysinfo.h"
#include "absl/container/flat_hash_set.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "tcmalloc/common.h"
#include "tcmalloc/internal/logging.h"
#include "tcmalloc/static_vars.h"
Expand Down
1 change: 1 addition & 0 deletions tcmalloc/huge_address_map_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "tcmalloc/huge_address_map.h"

#include <stdlib.h>

#include <vector>

#include "gmock/gmock.h"
Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/huge_allocator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
#include <utility>
#include <vector>

#include "gtest/gtest.h"
#include "absl/base/internal/cycleclock.h"
#include "absl/random/random.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "gtest/gtest.h"
#include "tcmalloc/huge_pages.h"
#include "tcmalloc/internal/logging.h"

Expand Down
5 changes: 2 additions & 3 deletions tcmalloc/huge_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#include <utility>
#include <vector>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/internal/cycleclock.h"
#include "absl/memory/memory.h"
#include "absl/random/random.h"
#include "absl/strings/str_cat.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "tcmalloc/huge_pages.h"
#include "tcmalloc/internal/logging.h"
#include "tcmalloc/stats.h"
Expand Down Expand Up @@ -514,7 +514,6 @@ TEST_F(HugeCacheTest, Usage) {
}

class MinMaxTrackerTest : public testing::Test {

protected:
void Advance(absl::Duration d) {
clock_ += absl::ToDoubleSeconds(d) * GetFakeClockFrequency();
Expand Down
3 changes: 2 additions & 1 deletion tcmalloc/huge_page_aware_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ Span *HugePageAwareAllocator::AllocLarge(Length n, bool *from_released) {
// typically faster and usually more space efficient, but it's sometimes
// catastrophic.
//
// See https://github.com/google/tcmalloc/tree/master/docs/regions-are-not-optional.md
// See
// https://github.com/google/tcmalloc/tree/master/docs/regions-are-not-optional.md
//
// So test directly if we're in the bad case--almost no binaries are.
// If not, just fall back to direct allocation (and hope we do hit that case!)
Expand Down
9 changes: 5 additions & 4 deletions tcmalloc/huge_page_aware_allocator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
#include <utility>
#include <vector>

#include "benchmark/benchmark.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/const_init.h"
#include "absl/base/internal/spinlock.h"
Expand All @@ -45,6 +42,9 @@
#include "absl/synchronization/barrier.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/time.h"
#include "benchmark/benchmark.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "tcmalloc/common.h"
#include "tcmalloc/huge_pages.h"
#include "tcmalloc/internal/logging.h"
Expand Down Expand Up @@ -169,7 +169,8 @@ class HugePageAwareAllocatorTest : public ::testing::Test {
// TODO(b/128521238): scalable RNG
absl::base_internal::SpinLockHolder h(&lock_);
if (absl::Bernoulli(rng_, 1.0 / 1000)) {
Length n = Length(1024) * (1 + absl::LogUniform<int32_t>(rng_, 0, (1 << 8) - 1));
Length n =
Length(1024) * (1 + absl::LogUniform<int32_t>(rng_, 0, (1 << 8) - 1));
n += Length(absl::Uniform<int32_t>(rng_, 0, 1024));
return n;
}
Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/huge_page_filler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ inline void HugePageFiller<TrackerType>::PrintInPbtxt(PbtxtRegion *hpaa) const {
hpaa->PrintI64(
"filler_hugepageable_used_bytes",
static_cast<uint64_t>(hugepage_frac() *
static_cast<double>(allocated_.in_bytes())));
static_cast<double>(allocated_.in_bytes())));
hpaa->PrintI64("filler_num_pages_subreleased",
subrelease_stats_.total_pages_subreleased.raw_num());
hpaa->PrintI64("filler_num_hugepages_broken",
Expand Down
10 changes: 4 additions & 6 deletions tcmalloc/huge_page_filler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#include <utility>
#include <vector>

#include "benchmark/benchmark.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/algorithm/container.h"
#include "absl/base/internal/sysinfo.h"
#include "absl/base/thread_annotations.h"
Expand All @@ -46,6 +43,9 @@
#include "absl/synchronization/mutex.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "benchmark/benchmark.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "tcmalloc/common.h"
#include "tcmalloc/huge_pages.h"
#include "tcmalloc/internal/logging.h"
Expand Down Expand Up @@ -684,9 +684,7 @@ class FillerTest : public testing::TestWithParam<FillerPartialRerelease> {
ResetClock();
}

~FillerTest() override {
EXPECT_EQ(NHugePages(0), filler_.size());
}
~FillerTest() override { EXPECT_EQ(NHugePages(0), filler_.size()); }

struct PAlloc {
FakeTracker *pt;
Expand Down
4 changes: 2 additions & 2 deletions tcmalloc/huge_region_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include <memory>
#include <vector>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/random/random.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "tcmalloc/common.h"
#include "tcmalloc/huge_pages.h"
#include "tcmalloc/internal/logging.h"
Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/internal/bits_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include <limits>
#include <memory>

#include "absl/random/random.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/random/random.h"

namespace tcmalloc {
namespace tcmalloc_internal {
Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/internal/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace tcmalloc_internal {
// return a const pointer into it.
// e.g. { "SHELL=/bin/bash", "MY_ENV_VAR=1", "" }
extern "C" char **environ;
const char* thread_safe_getenv(const char *env_var) {
const char *thread_safe_getenv(const char *env_var) {
int var_len = strlen(env_var);

char **envv = environ;
Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/internal/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace tcmalloc_internal {
// from thread_safe_getenv() may be safely queried in a multi-threaded context.
// If you have explicit synchronization with changes environment variables then
// any copies of the returned pointer must be invalidated across modification.
const char* thread_safe_getenv(const char *env_var);
const char* thread_safe_getenv(const char* env_var);

} // namespace tcmalloc_internal
} // namespace tcmalloc
Expand Down
4 changes: 2 additions & 2 deletions tcmalloc/internal/linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
namespace tcmalloc {

inline ABSL_ATTRIBUTE_ALWAYS_INLINE void *SLL_Next(void *t) {
return *(reinterpret_cast<void**>(t));
return *(reinterpret_cast<void **>(t));
}

inline void ABSL_ATTRIBUTE_ALWAYS_INLINE SLL_SetNext(void *t, void *n) {
*(reinterpret_cast<void**>(t)) = n;
*(reinterpret_cast<void **>(t)) = n;
}

inline void ABSL_ATTRIBUTE_ALWAYS_INLINE SLL_Push(void **list, void *element) {
Expand Down
4 changes: 2 additions & 2 deletions tcmalloc/internal/linked_list_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <algorithm>
#include <vector>

#include "benchmark/benchmark.h"
#include "gtest/gtest.h"
#include "absl/container/node_hash_set.h"
#include "absl/random/random.h"
#include "benchmark/benchmark.h"
#include "gtest/gtest.h"
#include "tcmalloc/internal/mock_span.h"

namespace tcmalloc {
Expand Down
13 changes: 4 additions & 9 deletions tcmalloc/internal/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ABSL_CONST_INIT static absl::base_internal::SpinLock crash_lock(
static bool crashed = false;

static const size_t kStatsBufferSize = 16 << 10;
static char stats_buffer[kStatsBufferSize] = { 0 };
static char stats_buffer[kStatsBufferSize] = {0};

namespace tcmalloc {

Expand Down Expand Up @@ -67,14 +67,9 @@ static Logger FormatLog(bool with_stack, const char* filename, int line,
Logger state;
state.p_ = state.buf_;
state.end_ = state.buf_ + sizeof(state.buf_);
state.AddStr(filename, strlen(filename))
&& state.AddStr(":", 1)
&& state.AddNum(line, 10)
&& state.AddStr("]", 1)
&& state.Add(a)
&& state.Add(b)
&& state.Add(c)
&& state.Add(d);
state.AddStr(filename, strlen(filename)) && state.AddStr(":", 1) &&
state.AddNum(line, 10) && state.AddStr("]", 1) && state.Add(a) &&
state.Add(b) && state.Add(c) && state.Add(d);

if (with_stack) {
state.trace.depth =
Expand Down
Loading