Skip to content

Conversation

@AvarianKnight
Copy link
Contributor

This uses the experimental MeasureMemory api to measure all of the context's used memory and stores the amount of used memory into the global g_memoryInfo.

This should add a decent bit of debugability to existing scripts that use V8, and hopefully help script devs figure out if they're using a lot of memory.

In the future it might make sense to have a "common" v8 class that we can use to share structure between the new Node ScRT and the v8 ScRT to reduce the duplication here.

This also cleans up some existing code by using the CfxV8EmbeddedData enum to better describe what certain embedder data does.

Goal of this PR

Add memory tracking to the v8 environment

This PR applies to the following area(s)

ScRT: JS, ScRT: Node

Successfully tested on

Game builds: 1491

Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

@github-actions github-actions bot added the ScRT: JS Issues/PRs related to the JavaScript scripting runtime label Dec 15, 2025
@github-actions github-actions bot added triage Needs a preliminary assessment to determine the urgency and required action invalid Requires changes before it's considered valid and can be (re)triaged and removed triage Needs a preliminary assessment to determine the urgency and required action labels Dec 15, 2025
This uses the experimental `MeasureMemory` api to measure all of the context's
used memory and stores the amount of used memory into the global `g_memoryInfo`.

This should add a decent bit of debugability to existing scripts that use V8, and hopefully
help script devs figure out if they're using a lot of memory.

In the future it might make sense to have a "common" v8 class that we can use to
share structure between the new Node ScRT and the v8 ScRT to reduce the duplication
here.

This also cleans up some existing code by using the `CfxV8EmbeddedData` enum to better
describe what certain embedder data does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged ScRT: JS Issues/PRs related to the JavaScript scripting runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant