---
title: GetHeapMiB
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/go/compute-sdk-go/compute/fn.GetHeapMiB/
---

**Kind:** Function  
**Module:** [compute](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/compute/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/compute/compute.go#L48

```go
func GetHeapMiB() (uint32, error)
```

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**

`(uint32, error)`
