Spogg wrote:tulamide wrote:... for all instances of the same plugin only one Ruby engine runs ...
I’ve read this before but not really understood just
how the Ruby engine can be shared and in common.
Does a plugin load the Ruby engine into memory and other similar or identical plugins will look there first? That would suggest something like static (absolute and defined) memory addressing rather than dynamic. It feels counter-intuitive that a DAW would allow such behaviour.
Just out of interest!
It has nothing to do with static memory.
But it has to do with how DAWs deal with plugins.
But first, please understand that Ruby is an application. It is just window-less. And just as you don't need static memory to run Flowstone, you also don't need it to run Ruby.
A dll contains instructions that tell the parent application what to do and how. It is not a fixed space in memory, filled with random bits and bytes. When a DAW loads a DLL it allows memory to be allocated for whatever functionality there is (here, instruments and effects) under supervision. You access the dll with so called entry points, which are specifically designed function calls. Now, when the same plugin is used again on another track, instead of allocating another huge portion of memory, it simply allows the same function calls to be executed in the original memory space. This is clever. It prevents memory overloading even under minimal RAM conditions, and at the same time the function calls are of course giving different results, depending on the caller. Exactly like two people can use a pocket calculator, the first asking for the result of 3 + 4, and the second asking for the result of 9 * 13. The same pocket calculator will give correct, different results to those two different people.
Since -spoken simplified- the dll only exists in memory once for all plugin instances, Ruby also exists only once for all instances, because only one dll called Ruby to run. It's a startup call, once loaded, it will neve be called again.
If I was good enough at explaining, you now also see why there are several Ruby apps running, when you load several different plugins.