Store samples as static data for usage across Dynamic libs?


#1

Hi all,

Since we are developing plug ins as dynamic libs, and static data are shared among all the instances of the plugins, are we good to store all (read only) sample/audio data as static data so all instances of the instrument plug-ins could share them?

E.g, we make a singleton as below. And all instances of our plugin could share and use the
samples.

 


class SamplePool
{
public:
    SamplePool();
    ~SamplePool();
    
    static std::vector<MySample> samples;
protected:
    
private:
    SamplePool(const SamplePool&);
    SamplePool& operator=(const SamplePool&);
};



Is this safe to carry this out for sampling instruments? Say the samples could be more than 2GB even when DFDed. 
I am quite sure that the static data (like the "samples") are shared among the plugin instances, but I am still afraid that I am missing something down there. Hope someone could tell me whether this is good or evil.

Thanks in advance.