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

    Resident set size: the physical memory the process is using right now. The same measurement as process.memoryUsage().rss.

  • 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 resident set size the process has had.

  • peakCommit: number

    The largest value currentCommit has had.