# Singletons and multiple instances

**URL:** <https://forum.juce.com/t/singletons-and-multiple-instances/1164>\
**Category:** Audio Plugins\
**Created:** [October 23, 2006, 2:37am UTC](https://forum.juce.com/t/singletons-and-multiple-instances/1164 "2006-10-23T02:37:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [October 23, 2006, 2:37am UTC](https://forum.juce.com/t/singletons-and-multiple-instances/1164/1 "2006-10-23T02:37:50Z")

</div>

I seem to remember using a singleton in a plugin experiment as a way of sharing data between instances of a plugin.

I can’t remember exactly what happened, but i think it ended up working. Is it safe to use a singleton in a plugin? My goal is for it NOT to share information between instances… i’m concerned that it may cause problems when it comes to closing an instance of the plugin (i.e. the plug should tidy away the singleton instance, but would this cause the destruction of the singleton used in other plugin instances?)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 23, 2006, 9:24am UTC](https://forum.juce.com/t/singletons-and-multiple-instances/1164/2 "2006-10-23T09:24:29Z")

</div>

If you make it inherit from DeletedOnShutdown, then that would work fine, as it’ll be deleted only when the dll is removed from memory (or when all the plugins are deleted on the mac)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 9:59am UTC](https://forum.juce.com/t/singletons-and-multiple-instances/1164/3 "2017-05-12T09:59:23Z")

</div>


