Skip to content

useMemory

Category
Export Size
524 B
Last Changed
last year

Reactive Memory Info.

Demo

Used
9.13 MB
Allocated
14.89 MB
Limit
4096.00 MB

Usage

ts
import { useMemory } from '@vueuse/core'

const { isSupported, memory } = useMemory()

Type Declarations

typescript
/**
 * Performance.memory
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
 */
export interface MemoryInfo {
  /**
   * The maximum size of the heap, in bytes, that is available to the context.
   */
  readonly jsHeapSizeLimit: number
  /**
   *  The total allocated heap size, in bytes.
   */
  readonly totalJSHeapSize: number
  /**
   * The currently active segment of JS heap, in bytes.
   */
  readonly usedJSHeapSize: number
  [Symbol.toStringTag]: "MemoryInfo"
}
export interface UseMemoryOptions extends UseIntervalFnOptions {
  interval?: number
}
/**
 * Reactive Memory Info.
 *
 * @see https://vueuse.org/useMemory
 * @param options
 */
export declare function useMemory(options?: UseMemoryOptions): {
  isSupported: ComputedRef<boolean>
  memory: Ref<MemoryInfo | undefined, MemoryInfo | undefined>
}
export type UseMemoryReturn = ReturnType<typeof useMemory>

Source

SourceDemoDocs

Contributors

Anthony Fu
Jelf
Anthony Fu
webfansplz

Changelog

No recent changes

Released under the MIT License.

The new era of AI engineering.
Workflows, artifacts, and judgment that scale.
Request Early Access