# HeapProfilerService

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/HeapProfilerService/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/HeapProfilerService

Generates and retrieves Luau heap memory profiles from the client and server Luau virtual machines for memory debugging.

## Methods

### ClientRequestDataAsync

```luau
HeapProfilerService:ClientRequestDataAsync(player: Player): string
```

- Tags: Yields, Plugin security

Yields until the Luau heap profile of the specified player's client is available, then returns it as a JSON string.

Parameters:

- `player`: The [`Player`](https://rapi.sleaze.dev/classes/Player.md) whose client Luau heap should be profiled.

Returns: A JSON-encoded string containing the client's Luau heap profile.

### ServerRequestDataAsync

```luau
HeapProfilerService:ServerRequestDataAsync(): string
```

- Tags: Yields, Plugin security

Yields until the server's Luau heap profile is available, then returns it as a JSON string.

Returns: A JSON-encoded string containing the server's Luau heap profile.

## Events

### OnNewData

```luau
HeapProfilerService.OnNewData: RBXScriptSignal<(player: Player, jsonString: buffer, id: number, compressedLength: number, uncompressedLength: number)>
```

- Tags: Plugin security

Fires on the requesting machine with the compressed Luau heap profile produced for an earlier request.

### RequestData

```luau
HeapProfilerService.RequestData: RBXScriptSignal<(id: number)>
```

- Tags: Hidden, Roblox engine security

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
