OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 }; | 241 }; |
242 | 242 |
243 // Allocates "bytes" worth of memory and returns it. Increments | 243 // Allocates "bytes" worth of memory and returns it. Increments |
244 // metadata_system_bytes appropriately. May return NULL if allocation | 244 // metadata_system_bytes appropriately. May return NULL if allocation |
245 // fails. Requires pageheap_lock is held. | 245 // fails. Requires pageheap_lock is held. |
246 void* MetaDataAlloc(size_t bytes); | 246 void* MetaDataAlloc(size_t bytes); |
247 | 247 |
248 // Returns the total number of bytes allocated from the system. | 248 // Returns the total number of bytes allocated from the system. |
249 // Requires pageheap_lock is held. | 249 // Requires pageheap_lock is held. |
250 uint64_t metadata_system_bytes(); | 250 uint64_t metadata_system_bytes(); |
| 251 uint64_t metadata_unmapped_bytes(); |
251 | 252 |
252 // Adjust metadata_system_bytes to indicate that bytes are actually committed. | 253 // Adjust metadata_system_bytes to indicate that bytes are actually committed. |
253 // Requires pageheap_lock is held. | 254 // Requires pageheap_lock is held. |
254 void increment_metadata_system_bytes(size_t bytes); | 255 void update_metadata_system_bytes(int diff); |
| 256 void update_metadata_unmapped_bytes(int diff); |
255 | 257 |
256 // size/depth are made the same size as a pointer so that some generic | 258 // size/depth are made the same size as a pointer so that some generic |
257 // code below can conveniently cast them back and forth to void*. | 259 // code below can conveniently cast them back and forth to void*. |
258 static const int kMaxStackDepth = 31; | 260 static const int kMaxStackDepth = 31; |
259 struct StackTrace { | 261 struct StackTrace { |
260 uintptr_t size; // Size of object | 262 uintptr_t size; // Size of object |
261 uintptr_t depth; // Number of PC values stored in array below | 263 uintptr_t depth; // Number of PC values stored in array below |
262 void* stack[kMaxStackDepth]; | 264 void* stack[kMaxStackDepth]; |
263 }; | 265 }; |
264 | 266 |
265 } // namespace tcmalloc | 267 } // namespace tcmalloc |
266 | 268 |
267 #endif // TCMALLOC_COMMON_H_ | 269 #endif // TCMALLOC_COMMON_H_ |
OLD | NEW |