Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High heap usage #19

Open
Tracked by #23
xxshady opened this issue Apr 18, 2023 · 2 comments
Open
Tracked by #23

High heap usage #19

xxshady opened this issue Apr 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@xxshady
Copy link
Owner

xxshady commented Apr 18, 2023

https://discord.com/channels/371265202378899476/576771706119520287/1094333403081486476

Temp fix:

// everywhere in your code
- import * as alt from 'alt-client'
+ import alt from 'alt-client'
// your esbuild build script
esbuild.build({
  plugins: [altvEsbuild({ altDefaultImport: true })]
})
@xxshady xxshady added the bug Something isn't working label Apr 18, 2023
@xxshady
Copy link
Owner Author

xxshady commented Jul 16, 2023

This problem may have already been self-fixed in JS API v2, since big clientside memory leaks of JS module v1 have been fixed

@xxshady
Copy link
Owner Author

xxshady commented Jul 21, 2024

additional note: do not import big .json files directly in .ts/.js (it gets inlined into js bundle in this case)

-import myJson from './myJson.json'

move .json to asset-pack resource and read it using alt.File.read on clientside and fs on serverside (alt.File doesn't work on serverside at this moment)

// clientside
+const myJson = JSON.parse(alt.File.read('@your-resource-name/myJson.json'))

seems like size of out .js somehow increases heap size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant