# SharedResourcePointer vs juce\_Singleton?

**URL:** <https://forum.juce.com/t/sharedresourcepointer-vs-juce-singleton/16739>\
**Category:** General JUCE discussion\
**Created:** [February 20, 2016, 5:15pm UTC](https://forum.juce.com/t/sharedresourcepointer-vs-juce-singleton/16739 "2016-02-20T17:15:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [February 20, 2016, 5:15pm UTC](https://forum.juce.com/t/sharedresourcepointer-vs-juce-singleton/16739/1 "2016-02-20T17:15:32Z")

</div>

which one? &nbsp;why?&nbsp;

I have a class that i'm trying to make static in my project. &nbsp;it needs access to some fonts that i've stored as a SharedResourcePointer through-out my other classes in the project as each module uses the fonts. When my app closes, i'm getting a LeakCounter jassertfalse on the SharedResourcePointer for one of my font objects when this singleton class tries to destruct. &nbsp;

---

<div class="post-metadata">

**Author:** ![jrlanglois](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jrlanglois/32/21372_2.png) [@jrlanglois](https://forum.juce.com/u/jrlanglois)\
**Post date:** [February 20, 2016, 7:22pm UTC](https://forum.juce.com/t/sharedresourcepointer-vs-juce-singleton/16739/2 "2016-02-20T19:22:00Z")

</div>

If you're writing a juce-based&nbsp;singleton using the macros, your class should&nbsp;inherit from DeletedAtShutdown.

https://www.juce.com/doc/classDeletedAtShutdown

Even better is&nbsp;a Myers singleton, though its use may be circumstancial. Example:

```
static Singleton& getInstance()
{
    static Singleton s;
    return s;
}
```

As for singleton vs SharedResourcePointer: I guess it depends! Jules wrote a bit about it here:&nbsp;http://www.juce.com/forum/topic/sharedresourcepointer
