---
title: heap_memory_snapshot_mib
summary: Get the current dynamic memory usage of this sandbox, rounded up to the nearest mebibyte (2^20 bytes).
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/compute_runtime/fn.heap_memory_snapshot_mib/
---

**Kind:** Function  
**Module:** [compute_runtime](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/compute_runtime/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/compute_runtime.rs#40

```rust
fn heap_memory_snapshot_mib() -> Result<u32, FastlyStatus>
```

Get the current dynamic memory usage of this sandbox, rounded up to the nearest mebibyte (2^20
bytes).

The memory accounted includes the WASM linear memory (i.e. heap memory), as well as some memory
used by the hosting environment; for instance, HTTP bodies that have been read from a TCP
connection, but not read by the WASM program. As such, this function provides only a snapshot
in time: the memory usage can change without any action from the WASM program. It can also
change across runs, as the Compute platform's memory usage changes. Consider the returned value
with these possibilities in mind.

**Returns**

`Result<u32, fastly_shared::FastlyStatus>`
