Interface nsIHandleReportCallbackType

Memory reporters measure Firefox's memory usage. They are primarily used to generate the about:memory page. You should read https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Memory_reporting before writing a memory reporter.

Hierarchy

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • The arguments to the callback are as follows.

    |process| The name of the process containing this reporter. Each reporter initially has "" in this field, indicating that it applies to the current process. (This is true even for reporters in a child process.) When a reporter from a child process is copied into the main process, the copy has its 'process' field set appropriately.

    |path| The path that this memory usage should be reported under. Paths are '/'-delimited, eg. "a/b/c".

    Each reporter can be viewed as representing a leaf node in a tree. Internal nodes of the tree don't have reporters. So, for example, the reporters "explicit/a/b", "explicit/a/c", "explicit/d/e", and "explicit/d/f" define this tree:

    explicit |--a | |--b [] | --c [] --d |--e [] --f []

    Nodes marked with a [*] have a reporter. Notice that the internal nodes are implicitly defined by the paths.

    Nodes within a tree should not overlap measurements, otherwise the parent node measurements will be double-counted. So in the example above, |b| should not count any allocations counted by |c|, and vice versa.

    All nodes within each tree must have the same units.

    If you want to include a '/' not as a path separator, e.g. because the path contains a URL, you need to convert each '/' in the URL to a ''. Consumers of the path will undo this change. Any other '' character in a path will also be changed. This is clumsy but hasn't caused any problems so far.

    The paths of all reporters form a set of trees. Trees can be "degenerate", i.e. contain a single entry with no '/'.

    |kind| There are three kinds of memory reporters.

    • HEAP: reporters measuring memory allocated by the heap allocator, e.g. by calling malloc, calloc, realloc, memalign, operator new, or operator new[]. Reporters in this category must have units UNITS_BYTES.

    • NONHEAP: reporters measuring memory which the program explicitly allocated, but does not live on the heap. Such memory is commonly allocated by calling one of the OS's memory-mapping functions (e.g. mmap, VirtualAlloc, or vm_allocate). Reporters in this category must have units UNITS_BYTES.

    • OTHER: reporters which don't fit into either of these categories. They can have any units.

    The kind only matters for reporters in the "explicit" tree; aboutMemory.js uses it to calculate "heap-unclassified".

    |units| The units on the reporter's amount. One of the following.

    • BYTES: The amount contains a number of bytes.

    • COUNT: The amount is an instantaneous count of things currently in existence. For instance, the number of tabs currently open would have units COUNT.

    • COUNT_CUMULATIVE: The amount contains the number of times some event has occurred since the application started up. For instance, the number of times the user has opened a new tab would have units COUNT_CUMULATIVE.

    The amount returned by a reporter with units COUNT_CUMULATIVE must never decrease over the lifetime of the application.

    • PERCENTAGE: The amount contains a fraction that should be expressed as a percentage. NOTE! The |amount| field should be given a value 100x the actual percentage; this number will be divided by 100 when shown. This allows a fractional percentage to be shown even though |amount| is an integer. E.g. if the actual percentage is 12.34%, |amount| should be 1234.

    Values greater than 100% are allowed.

    |amount| The numeric value reported by this memory reporter. Accesses can fail if something goes wrong when getting the amount.

    |description| A human-readable description of this memory usage report.

    Parameters

    • process: string
    • path: string
    • kind: int32_t
    • units: int32_t
    • amount: int64_t
    • description: string
    • data: nsISupports

    Returns void

Generated using TypeDoc