Jump to content
McKay Development

Advice needed on clearing picsCache, I'm struggling with RAM usage


Recommended Posts


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).



(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 by 3urobeat
Included node launch options
Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...