3urobeat Posted June 23, 2023 Report Posted June 23, 2023 (edited) Hey! I'm spawning multiple (possibly a few hundred) SteamUser objects and this can cause my application to crash as I'm reaching the nodejs process mem limit. I have therefore decided to investigate (instead of simply raising the limit, but I did do that as well): The picsCache seems to be the worst offender right now (~4MB per SteamUser instance) and as I only need it for a few seconds after 'ownershipCached' I'm trying to clear it. I have set 'changelistUpdateInterval' to 0 so it won't get refreshed and I'm deleting the 'picsCache' properties like this: this.user.picsCache.apps = {}; this.user.picsCache.packages = {}; After taking a few Memory Snapshots I saw that this seems to work, however the Garbage Collector is not taking action as there seems to be another reference to this object at 'apps.js:266' in an '_jobs' object. Sometimes this reference gets removed after some time. Do you have an idea how I could get rid of this reference? ...or would you be interested in providing a function in the lib to clear this cache in a more official way? I think this could be a useful feature. If you have any other ideas how I could reduce the memory usage, please let me know! The protobufs (in this case of steam-session and not steam-user) for example are at the top of my 'strings' list (probably nothing that can be done there). Thanks! (One more thing while you are here, could you please re-review my steamcommunity sharedfiles PR? I made the changes you requested shortly after. The disabled primaryGroup profile setting also works btw. Sorry for bothering!) Versions used: OS kernel: 6.3.8-arch1-1 Node: v20.3.1 (but the same behavior appears on other versions as well) steam-user: 4.28.6 argv used for node: --max-old-space-size=2048 --optimize-for-size Edited June 23, 2023 by 3urobeat Included node launch options Quote
3urobeat Posted June 26, 2023 Author Report Posted June 26, 2023 I implemented a function to solve this issue and opened a pull request: https://github.com/DoctorMcKay/node-steam-user/pull/444 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.