[Webkit-unassigned] [Bug 65768] New: On Windows MarkedBlock is using only 25% allocated of ram allocated for it causing JavaScriptCore to crash under moderate actual ram use.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 5 06:35:15 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=65768

           Summary: On Windows MarkedBlock is using only 25% allocated of
                    ram allocated for it causing JavaScriptCore to crash
                    under moderate actual ram use.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Major
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: michaelbraithwaite at turbulenz.com


This is with JSC from http://trac.webkit.org/browser/releases/WebKitGTK/webkit-1.4.2.

We are using JSC in to run complex 3D titles in a custom plugin. Some development builds of these allocate millions of objects which along with other assets can cause total memory use to grow >1GB. In some case JSC crashes due to VirtualAlloc() failing despite >1GB theoretically remaining free. In the extreme it crashes with only 650Mb in use.

Using VMMap http://technet.microsoft.com/en-us/sysinternals/dd535533.aspx  shows large amounts of ram as ‘unusable’, e.g. 600MB. Scanning through ram you see a repeated pattern of 16k used followed by 48k unused ram, which turn out to be the MarkedBlock allocations.

Basically this is because VirtualAlloc() is allocating in SYSTEM_INFO.dwAllocationGranularity (64k) blocks for any allocation but the code seems to be written assuming allocations are SYSTEM_INFO.dwPageSize (4k). Since MarkedBlock calls PageAllocationAligned::allocate() with 16k and 64k is actually allocate it wastes 48k.

Some possible fixes:-

a) Make MarkedBlock::blockSize 64k instead of 16k for Windows.

b) Update alignment in PageAllocationAligned::allocate(). For size & alignment <= SYSTEM_INFO.dwAllocationGranularity it doesn't need anything adding.

Doing a & b removed ~95% of the unused space and stops the crashes we were seeing. To verify this is the case a trivial loop allocating the remaining ram with VirtualAlloc() showed ~200Mb before these changes and >1GB after.

c) Change some uses of pageSize() to use system_info.dwAllocationGranularity. Its not clear to me which should be but using pageSize and which AllocationGranularity but forcing it to AllocationGranularity further lowers unused space down ~5% to 10Mb.

There are other uses eg ExecutablePool and TryVirtualAlloc that looks like they have the same issue. Basically search for VirtualAlloc and put conditional break points on <64k.

I tested this on Win7 64bit, Vista 64bit and XP 32bit.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list