Bug 164862 - [Win32] Start releasing memory earlier when memory is running low.
Summary: [Win32] Start releasing memory earlier when memory is running low.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-11-17 02:32 PST by Per Arne Vollan
Modified: 2016-11-18 02:03 PST (History)
4 users (show)

See Also:


Attachments
Patch (1.68 KB, patch)
2016-11-17 02:36 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2016-11-17 02:32:48 PST
On Windows, 32-bit processes have 2GB of memory available, where some is used by the system. Debugging has shown that allocations might fail and cause crashes when memory usage is > ~1GB. We should start releasing memory before we reach 1GB.
Comment 1 Per Arne Vollan 2016-11-17 02:36:29 PST
Created attachment 295043 [details]
Patch
Comment 2 Per Arne Vollan 2016-11-17 04:24:27 PST
<rdar://problem/27988989>
Comment 3 Brent Fulgham 2016-11-17 09:59:09 PST
Comment on attachment 295043 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=295043&action=review

r=me

> Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp:77
> +    const int maxMemoryUsageBytes = 0.9 * 1024 * 1024 * 1024;

So we trigger clean-up about 10% earlier than before? Seems reasonable.

Would it make sense to convert this from a floating point calculation to just hard-coding the actual integer value that results from this math?
Comment 4 Per Arne Vollan 2016-11-18 01:43:52 PST
(In reply to comment #3)
> Comment on attachment 295043 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=295043&action=review
> 
> r=me
> 
> > Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp:77
> > +    const int maxMemoryUsageBytes = 0.9 * 1024 * 1024 * 1024;
> 
> So we trigger clean-up about 10% earlier than before? Seems reasonable.
> 
> Would it make sense to convert this from a floating point calculation to
> just hard-coding the actual integer value that results from this math?

I checked the generated code, and the compiler will optimize this. Just let me know if you still want me to change it :)

Thanks for reviewing!
Comment 5 WebKit Commit Bot 2016-11-18 02:03:24 PST
Comment on attachment 295043 [details]
Patch

Clearing flags on attachment: 295043

Committed r208883: <http://trac.webkit.org/changeset/208883>
Comment 6 WebKit Commit Bot 2016-11-18 02:03:28 PST
All reviewed patches have been landed.  Closing bug.