Index: Source/wtf/PartitionAlloc.cpp |
diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp |
index 3ba965297d9ba85cbd9dd873a8778b2de68e049e..c2aa81299b03c81216fe29828893b95122bb838c 100644 |
--- a/Source/wtf/PartitionAlloc.cpp |
+++ b/Source/wtf/PartitionAlloc.cpp |
@@ -253,23 +253,21 @@ static void partitionAllocBaseShutdown(PartitionRootBase* root) |
root->initialized = false; |
// Now that we've examined all partition pages in all buckets, it's safe |
- // to free all our super pages. We first collect the super page pointers |
- // on the stack because some of them are themselves store in super pages. |
- char* superPages[kMaxPartitionSize / kSuperPageSize]; |
- size_t numSuperPages = 0; |
+ // to free all our super pages. Since the super page extent entries are |
+ // stored in the super pages, we need to be careful not to access them |
+ // after we've released the corresponding super page. |
PartitionSuperPageExtentEntry* entry = root->firstExtent; |
+ PartitionSuperPageExtentEntry* nextEntry; |
Tom Sepez
2014/10/16 16:45:33
nit: This can go inside the while loop, at 262 as
Jens Widell
2014/10/21 09:51:36
Done.
|
while (entry) { |
+ nextEntry = entry->next; |
char* superPage = entry->superPageBase; |
- while (superPage != entry->superPagesEnd) { |
- superPages[numSuperPages] = superPage; |
- numSuperPages++; |
+ char* superPagesEnd = entry->superPagesEnd; |
+ while (superPage != superPagesEnd) { |
Tom Sepez
2014/10/16 16:45:33
nit: Do you want < instead of != ?here?? At least
Jens Widell
2014/10/16 16:49:25
Old code did the same, so I guess it's never been
Jens Widell
2014/10/21 09:51:36
Done.
|
+ freePages(superPage, kSuperPageSize); |
superPage += kSuperPageSize; |
} |
- entry = entry->next; |
+ entry = nextEntry; |
} |
- ASSERT(numSuperPages == root->totalSizeOfSuperPages / kSuperPageSize); |
- for (size_t i = 0; i < numSuperPages; ++i) |
- freePages(superPages[i], kSuperPageSize); |
} |
bool partitionAllocShutdown(PartitionRoot* root) |
@@ -304,11 +302,6 @@ static NEVER_INLINE void partitionOutOfMemory() |
IMMEDIATE_CRASH(); |
} |
-static NEVER_INLINE void partitionFull() |
-{ |
- IMMEDIATE_CRASH(); |
-} |
- |
static ALWAYS_INLINE void partitionDecommitSystemPages(PartitionRootBase* root, void* addr, size_t len) |
{ |
decommitSystemPages(addr, len); |
@@ -340,8 +333,6 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root, |
// Need a new super page. |
root->totalSizeOfSuperPages += kSuperPageSize; |
- if (root->totalSizeOfSuperPages > kMaxPartitionSize) |
- partitionFull(); |
char* requestedAddress = root->nextSuperPage; |
char* superPage = reinterpret_cast<char*>(allocPages(requestedAddress, kSuperPageSize, kSuperPageSize)); |
if (UNLIKELY(!superPage)) { |