Bug 196963

Summary: [WTF] Generic memoryFootprint() implementation should use bmalloc on Linux
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, Basuke.Suzuki, don.olmstead, Hironori.Fujii, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch don.olmstead: review+

Description Zan Dobersek 2019-04-16 01:42:35 PDT
[WTF] Generic memoryFootprint() implementation should use bmalloc on Linux
Comment 1 Zan Dobersek 2019-04-16 02:42:59 PDT
Created attachment 367519 [details]
Patch
Comment 2 Don Olmstead 2019-04-16 09:02:45 PDT
Comment on attachment 367519 [details]
Patch

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

r=me with nits

> Source/WTF/wtf/generic/MemoryFootprintGeneric.cpp:29
> +#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && OS(LINUX)

Remove OS(LINUX) there's no reason for this to be OS specific.

> Source/WTF/wtf/generic/MemoryFootprintGeneric.cpp:37
> +#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && OS(LINUX)

Same
Comment 3 Zan Dobersek 2019-04-17 01:01:18 PDT
Comment on attachment 367519 [details]
Patch

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

>> Source/WTF/wtf/generic/MemoryFootprintGeneric.cpp:29
>> +#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && OS(LINUX)
> 
> Remove OS(LINUX) there's no reason for this to be OS specific.

Didn't mention it in ChangeLog when I should have, but this bmalloc API at the moment is only implemented and exposed on Linux and iOS platforms. Given this implementation of WTF::memoryFootprint() would be used only on Linux (iOS has a different one), the OS(LINUX) guard is used here.

The PlayStation port also uses this implementation, but I'm not sure whether bmalloc is used there and/or if the underlying OS identifies as Linux-like to the point of being able to use the bmalloc implementation.
Comment 4 Basuke Suzuki 2019-04-17 12:23:55 PDT
Comment on attachment 367519 [details]
Patch

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

>>> Source/WTF/wtf/generic/MemoryFootprintGeneric.cpp:29
>>> +#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && OS(LINUX)
>> 
>> Remove OS(LINUX) there's no reason for this to be OS specific.
> 
> Didn't mention it in ChangeLog when I should have, but this bmalloc API at the moment is only implemented and exposed on Linux and iOS platforms. Given this implementation of WTF::memoryFootprint() would be used only on Linux (iOS has a different one), the OS(LINUX) guard is used here.
> 
> The PlayStation port also uses this implementation, but I'm not sure whether bmalloc is used there and/or if the underlying OS identifies as Linux-like to the point of being able to use the bmalloc implementation.

We use bmalloc, but we didn't follow memoryFootprint() API yet. We'll see how we can do that and enable here also after doing that.
Comment 5 Zan Dobersek 2019-04-21 23:23:02 PDT
Committed r244496: <https://trac.webkit.org/changeset/244496>
Comment 6 Radar WebKit Bug Importer 2019-04-21 23:24:24 PDT
<rdar://problem/50087037>