Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/tcmalloc/chromium/src/gperftools/custom_allocator.h

Issue 986503002: components/metrics: Add runtime memory leak detector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style, comments, RAW_CHECK in stl_allocator.h Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CUSTOM_ALLOCATOR_H_
6 #define CUSTOM_ALLOCATOR_H_
7
8 #include <stddef.h>
9
10 // PERFTOOLS_DLL_DECL is unnecessary, as it is Windows specific.
11
12 // A container class for using LowLevelAlloc with STL_Allocator. The functions
13 // Allocate() and Free() must match the specificiations in STL_Allocator.
14 class CustomAllocator {
jar (doing other things) 2015/08/21 02:48:43 Why are we using a class, rather than a namespace?
Simon Que 2015/08/21 05:44:05 This is required as a template type for STL_Alloca
jar (doing other things) 2015/08/21 17:32:31 I see. SGTM.
15 public:
16 // This is a stateless class, but there is static data within the module that
17 // needs to be created and deleted.
18 static void Initialize();
19 static bool Shutdown();
20 static bool IsInitialized();
21
22 static void* Allocate(size_t size);
23 static void Free(void* ptr, size_t size);
24 };
25
26 #endif // CUSTOM_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698