# MemoryUsageMetric.SubMetric

Artifact: [androidx.benchmark:benchmark-macro](https://developer.android.com/jetpack/androidx/releases/benchmark) [View Source](https://cs.android.com/search?q=file:androidx/benchmark/macro/Metric.kt+class:androidx.benchmark.macro.MemoryUsageMetric.SubMetric) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

*** ** * ** ***


```
public enum MemoryUsageMetric.SubMetric extends Enum<@NonNull MemoryUsageMetric.SubMetric>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [kotlin.Enum](https://developer.android.com/reference/java/lang/Enum.html)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [MemoryUsageMetric.SubMetric](https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric)\> ||
|   | ↳ | [androidx.benchmark.macro.MemoryUsageMetric.SubMetric](https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric) |

*** ** * ** ***

## Summary

| ### Enum Values |
|---|---|
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#BitmapMemory` | Tracks the amount of Bitmap memory allocated for the process. |
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#Gpu` | Measures the amount of GPU-specific memory allocated for the process. |
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#HeapSize` | Tracks the total size of the Android Runtime (ART) heap. |
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#RssAnon` | Tracks anonymous resident set size memory. |
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#RssFile` | Tracks memory used to map files from disk into the process's address space. |
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#RssShmem` | Tracks shared memory resident in the process. |
| `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#Swap` | Tracks memory that has been swapped out to disk or compressed in zRAM. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric>` | `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#getEntries()()` Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric` | `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#valueOf(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)` Returns the enum constant of this type with the specified name. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull MemoryUsageMetric.SubMetric[]` | `https://developer.android.com/reference/androidx/benchmark/macro/MemoryUsageMetric.SubMetric#values()()` Returns an array containing the constants of this enum type, in the order they're declared. |

## Enum Values

### BitmapMemory

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.BitmapMemory
```

Tracks the amount of Bitmap memory allocated for the process.

Requires API 36+.

### Gpu

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.Gpu
```

Measures the amount of GPU-specific memory allocated for the process. This is particularly useful for identifying high memory usage related to textures, shaders, or other graphics-heavy components.

### HeapSize

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.HeapSize
```

Tracks the total size of the Android Runtime (ART) heap. These samples are typically captured immediately after a Garbage Collection (GC) event, providing a look at the "live" set of objects in the application's managed memory.

### RssAnon

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.RssAnon
```

Tracks anonymous resident set size memory. This represents memory allocated directly by the process---such as via malloc or mmap---that is not backed by any file on disk. It is often the primary indicator of the app's dynamic memory consumption.

### RssFile

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.RssFile
```

Tracks memory used to map files from disk into the process's address space. This includes shared libraries, dex files, and other resource assets loaded by the application.

### RssShmem

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.RssShmem
```

Tracks shared memory resident in the process. This includes memory shared between processes, such as shared buffers or specialized memory regions.

### Swap

```
MemoryUsageMetric.SubMetric MemoryUsageMetric.SubMetric.Swap
```

Tracks memory that has been swapped out to disk or compressed in zRAM. This represents memory that is currently not in physical RAM but is still allocated by the process.

Requires API 33+.

## Public methods

### getEntries

```
public final @NonNull EnumEntries<@NonNull MemoryUsageMetric.SubMetric> getEntries()
```

Returns an immutable `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.enums/-enum-entries/index.html` list containing the constants of this enum type, in the order they're declared.

### valueOf

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
public static final @NonNull MemoryUsageMetric.SubMetric valueOf(@NonNull String value)
```

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this enum type has no constant with the specified name |

### values

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/benchmark#1.2.0)

```
public static final @NonNull MemoryUsageMetric.SubMetric[] values()
```

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using `entries` property as a more efficient alternative returning an immutable list of enum entries.