[erlang-bugs] Re: R13B02-1: badmatch in memsup:get_memory_usage (Mac OS X 10.6)
Simon Cornish
zl9d97p02@REDACTED
Wed Oct 28 21:07:16 CET 2009
Hello,
Here is a patch against R12B-3 that solves your problem. Probably you
can apply it without too much hassle to R13 but I haven't the time to
look into that.
Regards,
Simon
On Sat, Oct 17, 2009 at 10:13 AM, Winston Smith
smith.winston.101-at-......... |erlang-mail|
<...> wrote:
> I found the problem, the output of vm_stat has changed in Snow Leopard
> (10.6) and the code in memsup.erl, in get_memory_usage({unix,darwin})
> fails to read the number of pages wired:
>
> get_memory_usage({unix,darwin}) ->
> Str = os:cmd("/usr/bin/vm_stat"),
> {ok, [Free],Str2} = io_lib:fread("Pages free:~d.",skip_to_eol(Str)),
> {ok, [Active],Str3} =
> io_lib:fread("Pages active:~d.", skip_to_eol(Str2)),
> {ok, [Inactive],Str4} =
> io_lib:fread("Pages inactive:~d.", skip_to_eol(Str3)),
> {ok, [Wired],_} =
> io_lib:fread("Pages wired down:~d.", skip_to_eol(Str4)), %% FAILS HERE
> NMemUsed = (Wired + Active + Inactive) * 4000,
> NMemTotal = NMemUsed + Free * 4000,
> {NMemUsed,NMemTotal};
>
>
> Here's the new output of vm_stat (they've inserted "Pages speculative"
> before "Pages wired down" comparing to 10.5):
>
> winston$ /usr/bin/vm_stat
> Mach Virtual Memory Statistics: (page size of 4096 bytes)
> Pages free: 110845.
> Pages active: 563208.
> Pages inactive: 201387.
> Pages speculative: 8936.
> Pages wired down: 164629.
> "Translation faults": 128602101.
> Pages copy-on-write: 2406604.
> Pages zero filled: 66882837.
> Pages reactivated: 39662.
> Pageins: 232245.
> Pageouts: 12164.
> Object cache: 173 hits of 69999244 lookups (0% hit rate)
>
>
> Hope this helps!
>
> Thanks.
>
>
> On Sat, Oct 17, 2009 at 12:14 AM, Winston Smith
> <smith.winston.101@REDACTED> wrote:
>> Running R13B02-1 on Mac OS 10.6.2 (x86_64), I'm seeing the following
>> error when I start my OTP application:
>>
>> =SUPERVISOR REPORT==== 17-Oct-2009::00:10:08 ===
>> Supervisor: {local,os_mon_sup}
>> Context: child_terminated
>> Reason: {{badmatch,{error,{fread,input}}},
>> [{memsup,get_memory_usage,1},
>> {memsup,'-handle_info/2-fun-0-',2}]}
>> Offender: [{pid,<0.74.0>},
>> {name,memsup},
>> {mfa,{memsup,start_link,[]}},
>> {restart_type,permanent},
>> {shutdown,2000},
>> {child_type,worker}]
>>
>>
>> Not sure how to diagnose this further ...
>>
>
> ________________________________________________________________
> erlang-bugs mailing list. See http://www.erlang.org/faq.html
> erlang-bugs (at) erlang.org
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memsup.patch
Type: application/octet-stream
Size: 920 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20091028/ebb8e5b3/attachment.obj>
More information about the erlang-bugs
mailing list