Changes between Version 2 and Version 3 of MemoryUtils


Ignore:
Timestamp:
Mar 25, 2010, 11:54:39 PM (9 years ago)
Author:
gz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MemoryUtils

    v2 v3  
    22
    33This section describes functions that could be useful in tracking down
    4 memory problems.  Currently many of these functions are only
    5 implemented on Linux.
     4memory problems.
    65
    76=== Heap objects ===
     
    1514areas to look in multiple areas.  If `area` is `nil` or not specified,
    1615looks in all the areas.
     16
     17`function` should try to avoid allocating memory.  While a little bit
     18of consing may be ok, excessive consing leading to garbage collection
     19will likely cause problems.
    1720
    1821
     
    3437
    3538[Function][[BR]]
    36 '''heap-utilization''' `&key`
    37 
    38 See HeapUtilization.
     39'''heap-utilization''' `&key` (''stream'' `*debug-io*`) (''gc-first'' `t`) (''area'' `nil`) (''unit'' `nil`) (''sort'' `:size`) (''classes'' `nil`) (''start'' `nil`) (''threshold'' `(and classes 0.0005)`)
     40
     41
     42`heap-utilization` walks the lisp heap, collects information about the objects stored on the heap, and prints a report of the results to ''stream''.  It shows the number of objects of each type, the logical size (i.e. the size of the data part of the object) and the physical size (the logical size plus any header and padding bytes).
     43
     44If ''gc-first'' is true (the default), does a full gc before scanning the heap.
     45
     46If ''classes'' is true, classifies objects by class rather than just basic type.
     47
     48''area'' can be used to restrict the walk to one memory area or a list of areas.  Some possible values are `:dynamic`, `:static`, `:managed-static`, `:readonly`.  By default, all areas (including stacks) are examined.
     49
     50''sort'' can be one of `:count`, `:logical-size`, or `:physical-size` to sort output by count or size.
     51
     52''unit'' can be one of `:kb` `:mb` or `:gb` to show sizes in units other than bytes.
     53
     54If ''start'' is non-nil, it should be an object returned by `get-allocation-sentinel`; only
     55objects at higher address are scanned (i.e. roughly, only objects allocated after it).
     56
     57If ''threshold'' is non-nil, it should be a number between 0 and 1.  All types whose share of the heap is less than ''threshold'' will be lumped together in an "All Others" line rather than being listed individually.
    3958
    4059
     
    92111A core dump file contains a copy of the Lisp heap of a process.  You
    93112can open a core file with `open-core`, and get a summary of the heap
    94 contents with `core-heap-utilization`.  Depending on how the core dump
     113contents with `core-heap-utilization` or `idom-heap-utilization`.
     114Depending on how the core dump
    95115was obtained, you might also be able to examine the stack with
    96116`core-print-call-history`.  If this is not enough, there are
    97 many functions available that let you examine individual objects,
     117many functions available that let you manually examine individual objects,
    98118map over symbols, etc.  Core file objects are represented as
    99119integers, encoding the address and the tag of the object, and there
     
    121141'''core-heap-utilization''' `&key (stream *debug-io*) area unit (sort :size) classes (threshold  0.00005)`
    122142
    123 Examines the lisp heap stored in the core file and reports the types of objects in it.  The arguments are as for [HeapUtilization heap-utilization].
     143Examines the lisp heap stored in the core file and reports the types of objects in it.  The arguments are as for heap-utilization above, except `area` can also be `:tenured` to restrict the computation to just the tenured part of the dynamic heap.
    124144
    125145[Function][[BR]]