| OLD | NEW |
| 1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2012, 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 |
| 11 // copyright notice, this list of conditions and the following disclaimer | 11 // copyright notice, this list of conditions and the following disclaimer |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 }; | 300 }; |
| 301 virtual Ownership GetOwnership(const void* p); | 301 virtual Ownership GetOwnership(const void* p); |
| 302 | 302 |
| 303 // The current malloc implementation. Always non-NULL. | 303 // The current malloc implementation. Always non-NULL. |
| 304 static MallocExtension* instance(); | 304 static MallocExtension* instance(); |
| 305 | 305 |
| 306 // Change the malloc implementation. Typically called by the | 306 // Change the malloc implementation. Typically called by the |
| 307 // malloc implementation during initialization. | 307 // malloc implementation during initialization. |
| 308 static void Register(MallocExtension* implementation); | 308 static void Register(MallocExtension* implementation); |
| 309 | 309 |
| 310 // On the current thread, return the total number of bytes allocated. |
| 311 // (Currently only implemented in tcmalloc.) |
| 312 static unsigned int GetBytesAllocatedOnCurrentThread(); |
| 313 |
| 310 // Returns detailed information about malloc's freelists. For each list, | 314 // Returns detailed information about malloc's freelists. For each list, |
| 311 // return a FreeListInfo: | 315 // return a FreeListInfo: |
| 312 struct FreeListInfo { | 316 struct FreeListInfo { |
| 313 size_t min_object_size; | 317 size_t min_object_size; |
| 314 size_t max_object_size; | 318 size_t max_object_size; |
| 315 size_t total_bytes_free; | 319 size_t total_bytes_free; |
| 316 const char* type; | 320 const char* type; |
| 317 }; | 321 }; |
| 318 // Each item in the vector refers to a different freelist. The lists | 322 // Each item in the vector refers to a different freelist. The lists |
| 319 // are identified by the range of allocations that objects in the | 323 // are identified by the range of allocations that objects in the |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 395 |
| 392 // Perhaps add the following: | 396 // Perhaps add the following: |
| 393 // - stack trace if this range was sampled | 397 // - stack trace if this range was sampled |
| 394 // - heap growth stack trace if applicable to this range | 398 // - heap growth stack trace if applicable to this range |
| 395 // - age when allocated (for inuse) or freed (if not in use) | 399 // - age when allocated (for inuse) or freed (if not in use) |
| 396 }; | 400 }; |
| 397 | 401 |
| 398 } // namespace base | 402 } // namespace base |
| 399 | 403 |
| 400 #endif // BASE_MALLOC_EXTENSION_H_ | 404 #endif // BASE_MALLOC_EXTENSION_H_ |
| OLD | NEW |