Memory leak on any (Kitchen-sink, Alchemist) plugin refresh

Noticed system slowdown while developing my plugin so started investigating a bit and found, that every panel reload increases memory usage in tens of MB. Same happens with Alchemist and Kitchen-sink (pretty much same amount of memory is taken on all of the three plugins tested)

Noticed this while was trying to free memory on React component unmount by clearing variables, but it didn’t help (still very new to React, so might be doing something wrong), but IMO refreshing should clear everything :thinking: Unloading a plugin (as displayed in video) clears the memory

Same happens on both Ps beta 23.1.0 and non beta 23.0.2 at least on Win10

Well, it depends… sometimes you need to increase memory a lot to get a garbage collector into the game.

The reason why this got my attention, is after developing for several days constantly on a watcher, which reloads plugin on every code change, just freezes Ps and couple of times simply crashed the system (w/ 32GB of RAM)

Once I had issue with memory and in my case it turned out that it was cause by console.log() since these messages are never cleared if you don’t clear it and are present even without the debugger.

In classic DevTools you can generate memory allocation chart to see where most memory is. But I am not sure about UXP DevTools.

Removed all logs and console is clear. Even when I use logging, I clear it before every reload.
I have no idea how (if there even is how) to find memory leak when there’s no errors or warnings at all and opening and closing same dialog over and over also increases memory usage by a couple of MBs (I’ll post maybe a separate topic about this issue)