Editor always in memory


#1

When you close your JUCE based plugin in any DAW, the Editor get’s deleted from memory. Is it ok to keep it in memoryh and delete/create just a wrapper component that displays the actual editor. This will help with values in various components on the editor, they won’t move when the plugin gets closed/created, and we won’t have to re-set all the values.

Is this OK ? i can live with the memory the editor consumes, but it will help me a lot since all my controls are dynamicly created based on some serialized data, and each time i show them i have to re-create their state based on that data. It’s allright for 20-100 controls, but i’d like to write some bigger editors (>200 controls) and this might be havy.

I guess this might cause some end-of-the-world scenario i haven’t thought of yet.


#2

It’s possible, but it’s not a good way to approach the problem…

You should only optimise if you actually need to do so. Maybe this won’t even be a problem when you try it? And if your controls are slow to open, optimise them! And if they’re still slow, maybe it’s because they’re using data that could be cached, rather than just saving the whole component? Just keeping a component off-screen would work, but it’s a really inelegant approach.


#3

i was using your approach hfor some time. but i’m keeping some data in the component’s properties, and the UI has to be assosiated with some low level controllers that generate midi data, so i need to link them each time thhe GUI is opened, and i can only link them based on eithher the pointer to thhe UI (witch changes every time the gui is closed) or some component property witch might take a lot more time (reading string from the UI component properties).

unless there is some better way.


#4

It’s hard to imagine what you could be doing that’d make it take longer than a few milliseconds to build a UI. I’d say don’t worry about optimising until you’ve actually tried it!


#5

i guess i wanted to make it simple. with thhe gui created only once during the plugin lifespan it gets simpler.

i’ll see what comes out of thhis, this time it’s a very simple editor so the amount of work should be very minimal.


#6

Personally, I’d feel happier knowing that my UI constructor/destructor code is getting tested every time I open and close the window.


#7