Changeset 34824 in webkit
- Timestamp:
- Jun 26, 2008 9:32:47 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r34821 r34824 1 2008-06-26 Mark Rowe <mrowe@apple.com> 2 3 Reviewed by Darin Adler and Geoff Garen. 4 5 Fix the malloc zone introspection functions so that malloc_zone_statistics does not give 6 bogus output in an application that uses JavaScriptCore. 7 8 * kjs/CollectorHeapIntrospector.cpp: 9 (KJS::CollectorHeapIntrospector::statistics): Return statistics about memory allocated by the collector. 10 * kjs/CollectorHeapIntrospector.h: 11 * wtf/FastMalloc.cpp: Zero out the statistics. FastMalloc doesn't track this information at present. 12 Returning zero for all values is preferable to returning bogus data. 13 1 14 2008-06-26 Darin Adler <darin@apple.com> 2 15 -
trunk/JavaScriptCore/kjs/CollectorHeapIntrospector.cpp
r30576 r34824 94 94 } 95 95 96 void CollectorHeapIntrospector::statistics(malloc_zone_t* zone, malloc_statistics_t* stats) 97 { 98 JSLock lock; 99 CollectorHeapIntrospector* introspector = reinterpret_cast<CollectorHeapIntrospector*>(zone); 100 CollectorHeap* primaryHeap = introspector->m_primaryHeap; 101 CollectorHeap* numberHeap = introspector->m_numberHeap; 102 stats->blocks_in_use = primaryHeap->usedBlocks + numberHeap->usedBlocks; 103 stats->size_in_use = primaryHeap->usedBlocks * BLOCK_SIZE + numberHeap->usedBlocks * BLOCK_SIZE; 104 stats->max_size_in_use = stats->size_in_use; 105 stats->size_allocated = primaryHeap->numBlocks * BLOCK_SIZE + numberHeap->numBlocks * BLOCK_SIZE; 106 } 107 96 108 } // namespace KJS -
trunk/JavaScriptCore/kjs/CollectorHeapIntrospector.h
r29663 r34824 47 47 static void forceLock(malloc_zone_t*) { } 48 48 static void forceUnlock(malloc_zone_t*) { } 49 static void statistics(malloc_zone_t*, malloc_statistics_t*) { }49 static void statistics(malloc_zone_t*, malloc_statistics_t*); 50 50 51 51 private: -
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r34756 r34824 298 298 static void forceLock(malloc_zone_t*) { } 299 299 static void forceUnlock(malloc_zone_t*) { } 300 static void statistics(malloc_zone_t*, malloc_statistics_t* ) {}300 static void statistics(malloc_zone_t*, malloc_statistics_t* stats) { memset(stats, 0, sizeof(malloc_statistics_t)); } 301 301 302 302 private:
Note: See TracChangeset
for help on using the changeset viewer.