Troubleshooting a JavaScript memory leak

Should I be sorting heap objects by distance, shallow size, or retained size? JavsScript memory is managed automatically, meaning the JS engine's garbage collector releases heap memory automatically when they are no longer in use.…