[Webkit-unassigned] [Bug 91214] [EFL] Add WebMemorySampler feature.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 28 19:39:56 PDT 2012


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





--- Comment #45 from JungJik Lee <jungjik.lee at samsung.com>  2012-08-28 19:39:58 PST ---
(From update of attachment 160928)
View in context: https://bugs.webkit.org/attachment.cgi?id=160928&action=review

>> Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp:96
>> +}
> 
> I think instead of parsing /proc/meminfo you could use sysinfo(2) to get the same information with simpler code (no need to use insecure fscanf).

this is really good, thanks your help. I didn't know there is such an API for linux. I will replace the code with the API.

>> Source/WebKit2/Shared/linux/WebMemorySamplerLinux.cpp:103
>> +    FILE* fMemoryStatus = fopen(processPath, "r");
> 
> I think you can simplify this to
> 
>     FILE* fMemoryStatus = fopen("/proc/self/statm", "r");
> 
> or alternatively get try to get the same information using getrusage(2) and getrlimit(2).
> 
> I think a programmatic approach is nicer than parsing files in /proc.

I googled the usage of getrusage(2) and getrlimit(2) but I am not sure that I can replace info which is used now.
getrusage(2) gives some data but some fields of the data is unused on linux. getrlimit(2) is for getting the limitation of the resource the device provides.
I was also worried about using fscanf. so I'll change the code by not using fscanf for security.

-- 
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