Garbage collection doesn't prevent memory leaks. Nothing stops you from filling up a Map and never emptying it
A more useful definition is memory that remains allocated unintentionally.
If your program continuously allocates memory that it doesn't free and doesn't serve a useful purpose, it doesn't really matter if it's, e.g., being referenced by some cache or just completely unreferenced -- it's still causing the same problem and has the same solution (that is, release the memory when you're done with it -- whether that's by calling "free" or clearing the reference, or whatever your memory management system has)
Here are common pitfalls: https://auth0.com/blog/four-types-of-leaks-in-your-javascrip...