I've been looking into memory leaks for an Electron app recently, and a major source of problems are strings, strings have sort of this hidden feature/bug: if you slice a string a new string is not allocated in memory, instead the original string is kept in memory and a couple of numbers indicating the start and the end of the slice as indexes in the parent string are kept in memory. It sounds alright, good for memory usage even, but in many cases you'll be consuming way too much memory because of this.
Example: you split a string into words for spell-checking purposes, once you've spell-checked each word you cache it so that you don't have to ask the spell-checker again if it's valid or not, now each time the original string is edited every single intermediate string produced during the edit could be kept in memory just because you are caching a word out of each of them. This can get out of hand super quickly.
Each time you are extracting a string out of another string this problem can arise.