function

jsc.memoryUsage

Returns memory statistics for the whole Bun process: resident set size, committed memory, and page faults. See MemoryUsage for what each field measures.

Unlike heapSize and heapStats, this includes memory that is not part of the JavaScript heap.

Referenced types

interface MemoryUsage

Memory statistics for the whole process, returned by memoryUsage. Sizes are in bytes.

  • current: number

    The physical memory the process is using right now. The same measurement as process.memoryUsage().rss: the resident set size on Linux and Windows, and on macOS the memory footprint that Activity Monitor shows (phys_footprint, which also counts compressed pages and leaves out clean file-backed ones).

  • currentCommit: number

    On macOS and Linux, the memory currently committed by mimalloc, the allocator Bun uses for memory outside the JavaScript heap. On Windows, the process's commit charge.

  • pageFaults: number

    On macOS and Linux, the number of major page faults (faults that had to read from disk) the process has taken. On Windows, the total number of page faults.

  • peak: number

    The largest value current has had over the life of the process.

  • peakCommit: number

    The largest value currentCommit has had.