I have a NodeJS server application (standard Node, Express, Socket.io combination). I have a constructor function called Player
that's used for various things, and when a user signs out, ideally their associated Player object will have all its references removed so it can be garbage collected. However, as these Player object references are passed around to quite a few modules, stored in various lists, etc., I'm not 100% sure they're being cleaned up as completely as they should be.
Is there a way to track the amount of memory used by a certain class/constructor function in NodeJS, so I can make sure they're being freed properly?
I know you can track overall heap usage from the process
instance directly, but that doesn't tell me what's using the memory, so it doesn't help me ensure that this particular object is being cleared.
EDIT If it helps, the repo for the project in question can be found here: https://github.com/IceMetalPunk/Graphite-Node . The Player class is defined in Server/entities.js
but used in a bunch of other places.