Share MATLAB Runtime Instances
What Is a Singleton MATLAB Runtime?
You create an instance of the MATLAB® Runtime that can be shared among all subsequent class instances within a component. This is commonly called a shared MATLAB Runtime instance or a Singleton runtime.
Advantages and Disadvantages of Using a Singleton
In most cases, a singleton MATLAB Runtime will provide many more advantages than disadvantages. Following are examples of when you might and might not create a shared MATLAB Runtime instance.
When You Should Use a Singleton
If you have multiple users running from a specific instance of MATLAB, using a singleton will most likely:
Utilize system memory more efficiently
Decrease MATLAB Runtime start-up or initialization time
When You Might Avoid Using a Singleton
Using a singleton may not benefit you if your application uses a large number of global variables. This causes crosstalk.