Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Jenx memory usage is high #32

Closed
msabramo opened this Issue · 1 comment

1 participant

@msabramo
Collaborator

Jenx's VSZ immediately after startup is 11 GB ?!?!

$ psgrep Jenx
USER    PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
marca 75972   0.0  1.0 11216492  40260   ??  SX    8:55PM   0:01.50 /Users/marca/Library/Developer/Xcode/DerivedData/jenx-bbdotppzsoqikxdtnykfwxlhldjo/Build/Products/Debug/jenx.app/Contents/MacOS/Jenx

$ top -pid 75972 -l 1 | tail -2
PID    COMMAND %CPU TIME     #TH #WQ #PORTS #MREGS RPRVT RSHRD RSIZE VPRVT VSIZE PGRP  PPID  STATE    UID       FAULTS COW  MSGSENT MSGRECV SYSBSD SYSMACH CSW   PAGEINS USER 
75972  Jenx    0.0  00:01.50 2   1   94+    353+   23M+  42M+  38M+  354M+ 11G+  75972 75963 sleeping 346486362 10846+ 372+ 9576+   4610+   8310+  9906+   6621+ 5+      marca

The RSS is much more reasonable, but I can't imagine why the VSZ is so huge.

@msabramo
Collaborator

Hmmmm, I think this is actually an issue with how OS X reserves memory for 64 bit processes and how it reports it.

marca@SCML-MarcA:~$ cat macruby_test.rb 
print "What's your name? "
name = gets.chop
puts "Hi, #{name}!"

marca@SCML-MarcA:~$ psgrep macruby
USER    PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
marca 76551   0.0  0.3 10899176  12272 s004  S+    9:09PM   0:00.06 macruby macruby_test.rb

marca@SCML-MarcA:~$ top -pid 76551 -l 1 | tail -2
PID    COMMAND %CPU TIME     #TH #WQ #PORTS #MREGS RPRVT  RSHRD RSIZE VPRVT VSIZE PGRP  PPID  STATE    UID       FAULTS COW  MSGSENT MSGRECV SYSBSD SYSMACH CSW PAGEINS USER 
76551  macruby 0.0  00:00.06 1   0   40+    131+   5640K+ 15M+  12M+  323M+ 10G+  76551 72846 sleeping 346486362 3266+  189+ 234+    115+    254+   157+    35+ 0       marca

What this shows is a ridiculously simple Ruby program having a VSIZE of 10 GB.

OTOH, Activity Monitor shows up a much more sane "Virtual Mem" of 315.0 MB for this process:

http://cl.ly/3F3N0P2M0l2O3q0b280Y

Also, vmmap seems to indicate that most of the virtual memory comes from "reserved VM address space (unallocated)" and it seems to consider this as unimportant:

marca@SCML-MarcA:~$ vmmap 76551
Virtual Memory Map of process 76551 (macruby)
Output report format:  2.2  -- 64-bit process

...

==== Summary for process 76551
ReadOnly portion of Libraries: Total=68.5M resident=59.0M(86%) swapped_out_or_unallocated=9792K(14%)
Writable regions: Total=8.1G written=5068K(0%) resident=5164K(0%) swapped_out=0K(0%) unallocated=8.1G(100%)

REGION TYPE                      VIRTUAL
===========                      =======
MALLOC                            286.3M        see MALLOC ZONE table below
MALLOC (reserved)                   7.8G        reserved VM address space (unallocated)
...
===========                      =======
TOTAL                               8.2G
TOTAL, minus reserved VM space    463.3M

                                     VIRTUAL ALLOCATION      BYTES
MALLOC ZONE                             SIZE      COUNT  ALLOCATED  % FULL
===========                          =======  =========  =========  ======
auto_zone_0x100bbd000                 256.0M      10635       680K      0%
DefaultMallocZone_0x100b5b000          29.2M      28569      3207K     10%
DispatchContinuations_0x100bfe000      1024K          1         32      0%
===========                          =======  =========  =========  ======
TOTAL                                 286.3M      39205      3887K      1%
@msabramo msabramo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.