⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 173524 in webkit


Ignore:
Timestamp:
Sep 11, 2014, 12:05:38 PM (12 years ago)
Author:
ggaren@apple.com
Message:

bmalloc: eager scavenge leaves behind a bogus allocator
​https://bugs.webkit.org/show_bug.cgi?id=136743

Reviewed by Sam Weinig.

Be sure to clear the allocator after logging it in the eager scavenge
case, so that we don't later try to allocate out of the lines that we
have thrown away.

We didn't need to do this previously because scavenge would only happen
at thread exit time, after which no further allocation from the per-thread
cache would take place.

  • bmalloc/Allocator.cpp:

(bmalloc::Allocator::scavenge):

  • bmalloc/MediumAllocator.h:

(bmalloc::MediumAllocator::clear):

  • bmalloc/SmallAllocator.h:

(bmalloc::SmallAllocator::clear):

Location:
trunk/Source/bmalloc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r173346 r173524  
     12014-09-11  Geoffrey Garen  <ggaren@apple.com>
     2
     3        bmalloc: eager scavenge leaves behind a bogus allocator
     4        https://bugs.webkit.org/show_bug.cgi?id=136743
     5
     6        Reviewed by Sam Weinig.
     7
     8        Be sure to clear the allocator after logging it in the eager scavenge
     9        case, so that we don't later try to allocate out of the lines that we
     10        have thrown away.
     11
     12        We didn't need to do this previously because scavenge would only happen
     13        at thread exit time, after which no further allocation from the per-thread
     14        cache would take place.
     15
     16        * bmalloc/Allocator.cpp:
     17        (bmalloc::Allocator::scavenge):
     18        * bmalloc/MediumAllocator.h:
     19        (bmalloc::MediumAllocator::clear):
     20        * bmalloc/SmallAllocator.h:
     21        (bmalloc::SmallAllocator::clear):
     22
    1232014-09-05  Geoffrey Garen  <ggaren@apple.com>
    224
  • trunk/Source/bmalloc/bmalloc/Allocator.cpp

    r167570 r173524  
    5757void Allocator::scavenge()
    5858{
    59     for (auto& allocator : m_smallAllocators)
     59    for (auto& allocator : m_smallAllocators) {
    6060        log(allocator);
     61        allocator.clear();
     62    }
    6163    processSmallAllocatorLog();
    6264
    6365    log(m_mediumAllocator);
     66    m_mediumAllocator.clear();
    6467    processMediumAllocatorLog();
    6568}
  • trunk/Source/bmalloc/bmalloc/MediumAllocator.h

    r167546 r173524  
    4646
    4747    unsigned char derefCount();
     48
    4849    void refill(MediumLine*);
     50    void clear();
    4951
    5052private:
    … …  
    102104}
    103105
     106inline void MediumAllocator::clear()
     107{
     108    m_end = nullptr;
     109    m_remaining = 0;
     110    m_objectCount = 0;
     111}
     112
    104113} // namespace bmalloc
    105114
  • trunk/Source/bmalloc/bmalloc/SmallAllocator.h

    r167546 r173524  
    4848    unsigned short objectCount();
    4949    unsigned char derefCount();
     50
    5051    void refill(SmallLine*);
     52    void clear();
    5153
    5254private:
    … …  
    108110}
    109111
     112inline void SmallAllocator::clear()
     113{
     114    m_ptr = nullptr;
     115    m_remaining = 0;
     116}
     117
    110118} // namespace bmalloc
    111119
Note: See TracChangeset for help on using the changeset viewer.