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

Side by Side Diff: Source/wtf/Partitions.h

Issue 1315113006: Add partitionsOutOfMemoryUsingXXX to know Blink memory usage from OOM crash reports (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 3 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
« no previous file with comments | « Source/wtf/PartitionAlloc.cpp ('k') | Source/wtf/Partitions.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ALWAYS_INLINE static void bufferFree(void* p) 111 ALWAYS_INLINE static void bufferFree(void* p)
112 { 112 {
113 partitionFreeGeneric(bufferPartition(), p); 113 partitionFreeGeneric(bufferPartition(), p);
114 } 114 }
115 115
116 ALWAYS_INLINE static size_t bufferActualSize(size_t n) 116 ALWAYS_INLINE static size_t bufferActualSize(size_t n)
117 { 117 {
118 return partitionAllocActualSize(bufferPartition(), n); 118 return partitionAllocActualSize(bufferPartition(), n);
119 } 119 }
120 120
121 static void handleOutOfMemory();
122
121 private: 123 private:
122 static int s_initializationLock; 124 static int s_initializationLock;
123 static bool s_initialized; 125 static bool s_initialized;
124 126
125 // We have the following four partitions. 127 // We have the following four partitions.
126 // - Node partition: A partition to allocate Nodes. We prepare a 128 // - Node partition: A partition to allocate Nodes. We prepare a
127 // dedicated partition for Nodes because Nodes are likely to be 129 // dedicated partition for Nodes because Nodes are likely to be
128 // a source of use-after-frees. Another reason is for performance: 130 // a source of use-after-frees. Another reason is for performance:
129 // Since Nodes are guaranteed to be used only by the main 131 // Since Nodes are guaranteed to be used only by the main
130 // thread, we can bypass acquiring a lock. Also we can improve memory 132 // thread, we can bypass acquiring a lock. Also we can improve memory
131 // locality by putting Nodes together. 133 // locality by putting Nodes together.
132 // - Layout object partition: A partition to allocate LayoutObjects. 134 // - Layout object partition: A partition to allocate LayoutObjects.
133 // we prepare a dedicated partition for the same reason as Nodes. 135 // we prepare a dedicated partition for the same reason as Nodes.
134 // - Buffer partition: A partition to allocate objects that have a strong 136 // - Buffer partition: A partition to allocate objects that have a strong
135 // risk where the length and/or the contents are exploited from user 137 // risk where the length and/or the contents are exploited from user
136 // scripts. Vectors, HashTables, ArrayBufferContents and Strings are 138 // scripts. Vectors, HashTables, ArrayBufferContents and Strings are
137 // allocated in the buffer partition. 139 // allocated in the buffer partition.
138 // - Fast malloc partition: A partition to allocate all other objects. 140 // - Fast malloc partition: A partition to allocate all other objects.
139 static PartitionAllocatorGeneric m_fastMallocAllocator; 141 static PartitionAllocatorGeneric m_fastMallocAllocator;
140 static PartitionAllocatorGeneric m_bufferAllocator; 142 static PartitionAllocatorGeneric m_bufferAllocator;
141 static SizeSpecificPartitionAllocator<3328> m_nodeAllocator; 143 static SizeSpecificPartitionAllocator<3328> m_nodeAllocator;
142 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator; 144 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator;
143 static HistogramEnumerationFunction m_histogramEnumeration; 145 static HistogramEnumerationFunction m_histogramEnumeration;
144 }; 146 };
145 147
146 } // namespace WTF 148 } // namespace WTF
147 149
148 #endif // Partitions_h 150 #endif // Partitions_h
OLDNEW
« no previous file with comments | « Source/wtf/PartitionAlloc.cpp ('k') | Source/wtf/Partitions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698