How to take heap snapshot in read-only file system?

I am tracking memory leak in node.js app, however I am not able to reproduce it locally on dev version - it appears only in production app under constant load. App is hosted on heroku so I am not able to perform normal heap snapshot/dump (heroku file system is read-only, and all libraries I know save heap snapshots to a file). I is there any other way to do a heap snapshot to memory (not to file) and return it as a file from REST API for example?