nsIMemoryReporter

Reports memory usage information for a single area of the software.
1.0
39
Introduced
Gecko 1.9
Inherits from: nsISupports Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)

Any piece of code that wishes to allow its memory use to be monitored may create an nsIMemoryReporter object and then register it by calling nsIMemoryReporterManager.registerReporter(). Once that has been done, the reporter will be found by any client accessing the enumerator returned by nsIMemoryReporterManager.enumerateReporters(). This includes the about:memory page.

Note: This interface is undergoing heavy development, and is subject to rapid changes.

Attributes

Attribute Type Description
amount PRInt64

The numeric value reported by the memory reporter, specified in the units indicated by the units attribute. Read only.

Note: This attribute was called memoryUsed prior to Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), and its type was long long.
description AUTF8String A human-readable description of this memory usage report. Read only.
kind PRInt32 The memory kind, one of the Memory reporter kind constants below. Read only.
path AUTF8String The path that this memory usage should be reported under. Paths are delimited with '/' characters to allow a hierarchy of memory to be displayed in about:memory. As of Gecko 6.0, the path should start with "explicit/" if the memory report accounts for all memory reported under sub-paths. Read only.
process ACString The name of the process containing this reporter. Each reporter starts with an empty string for this value, 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's process field is set appropriately. Read only.
units PRInt32 The units used by the amount attribute; this will be one of the Unit type constants. Read only.

Constants

Memory reporter kind constants

These allocation kind constants describe the types of memory allocation described by memory use reporters.

Constant Value Description
KIND_MAPPED 0 This is deprecated synonym for KIND_NONHEAP. Deprecated since Gecko 8.0
KIND_NONHEAP 0 Allocated directly by OS calls e.g. mmap, VirtualAlloc, vm_allocate etc.
KIND_HEAP 1 Allocated by the heap allocator, e.g. malloc, new etc.
KIND_OTHER 2 An allocation that does not fit into another KIND category.

Unit type constants

(Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4)

The amount reported by a memory reporter may use one of the following units.

Constant Value Description
UNITS_BYTES 0 The amount is specified as a number of bytes.
UNITS_COUNT 1 The amount is an instantaneous count of things currently in existence. For example, the number of tabs currently open.
UNITS_COUNT_CUMULATIVE 2 The amount contains the number of times some event has occurred since the application started up. For example, the number of times the user has opened a new tab. The amount returned must never decrease over the lifetime of the application.
UNITS_PERCENTAGE 3 The amount contains a fraction that should be expressed as a percentage.
Note: The amount field should be given a value 100 times 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. For example if the actual percentage is 12.34%, amount should be 1234.

See also

Document Tags and Contributors

 Contributors to this page: Dholbert, Sheppy, trevorh, Neil
 Last updated by: Dholbert,