react-native
Version:
A framework for building native apps using React
55 lines (47 loc) • 1.31 kB
JavaScript
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
* @oncall react_native
*/
// flowlint unsafe-getters-setters:off
type MemoryInfoLike = {
jsHeapSizeLimit: ?number,
totalJSHeapSize: ?number,
usedJSHeapSize: ?number,
};
// Read-only object with JS memory information. This is returned by the performance.memory API.
export default class MemoryInfo {
constructor(memoryInfo: ?MemoryInfoLike) {
if (memoryInfo != null) {
this.
this.
this.
}
}
/**
* The maximum size of the heap, in bytes, that is available to the context
*/
get jsHeapSizeLimit(): ?number {
return this.
}
/**
* The total allocated heap size, in bytes
*/
get totalJSHeapSize(): ?number {
return this.
}
/**
* The currently active segment of JS heap, in bytes.
*/
get usedJSHeapSize(): ?number {
return this.
}
}