# Leaked OSXTypeface and WindowsDirectWriteTypeface

**URL:** <https://forum.juce.com/t/leaked-osxtypeface-and-windowsdirectwritetypeface/37677>\
**Category:** General JUCE discussion\
**Created:** [February 19, 2020, 1:22pm UTC](https://forum.juce.com/t/leaked-osxtypeface-and-windowsdirectwritetypeface/37677 "2020-02-19T13:22:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pajczur](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pajczur](https://forum.juce.com/u/pajczur)\
**Post date:** [February 19, 2020, 1:22pm UTC](https://forum.juce.com/t/leaked-osxtypeface-and-windowsdirectwritetypeface/37677/1 "2020-02-19T13:22:37Z")

</div>

Hello,  
I know that subject wast talked many times, but I 've found the last update from about 4 years ago. And no one thread about both leakages at once, OSXTypeface and WindowsDirectWriteTypeface.

And I have such issue from some time (about 2 weeks ago I found that first time) with leaking OSXTypeface on OSX, and WindowsDirectWriteTypeface on Windows.

And I am not sure if it is after last updates of JUCE libraries, or it’s because some of my code changes.

It happens only when I close host with my plugin, or when I remove my plugin from the host.  
Is that something that I should worry?

Even if it’s not a problem, is there any way to avoid such issue?

---

<div class="post-metadata">

**Author:** ![ImJimmi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/imjimmi/32/10843_2.png) [@ImJimmi](https://forum.juce.com/u/ImJimmi)\
**Post date:** [February 19, 2020, 2:29pm UTC](https://forum.juce.com/t/leaked-osxtypeface-and-windowsdirectwritetypeface/37677/2 "2020-02-19T14:29:15Z")

</div>

If you’ve got memory leaks then you’ve created some object(s) using `new` but not deleted them. If it’s happening when you close the plug-in window then you’ve presumably created an object with `new` in your PluginEditor class (or one of it’s subcomponents) without deleting it.

Go through your code and make sure you’re properly deleting any objects you create - I’d recommend using smart pointers where you can.

> [@pajczur](#):
>
> Is that something that I should worry?

Yes, memory leaks are not good. You need to fix them.

---

<div class="post-metadata">

**Author:** ![pajczur](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pajczur](https://forum.juce.com/u/pajczur)\
**Post date:** [February 19, 2020, 3:40pm UTC](https://forum.juce.com/t/leaked-osxtypeface-and-windowsdirectwritetypeface/37677/3 "2020-02-19T15:40:43Z")

</div>

Hello,  
great thanks for your support. But the only code where I use `new` in my projects is in two methods:

> ```
> AudioProcessorEditor* MyAudioProcessor::createEditor()
> {
> return new MyAudioProcessorEditor (*this);
> }
> 
> ```

and:

> ```
> AudioProcessor* JUCE_CALLTYPE createPluginFilter()
> {
> return new MyAudioProcessor();
> }
> 
> ```

And both of those methods was created automaticaly by creating JUCE plugin project in Projucer. So I am little bit affraid to change here anything. I believe it’s deeply deliberated.

Also on other thread I found something like that (but it’s from 2014):

> [@Leaked OSXTypeface objects on iOS only](https://forum.juce.com/t/leaked-osxtypeface-objects-on-ios-only/12883/2):
>
> I think&nbsp;iOS can sometimes just call exit() on a process without allowing it to shutdown gracefully, in which case you'll get leaks of any objects that would have been deleted by DeletedAtShutdown, like the typeface cache. But it doesn't actually matter if the process is getting killed, so probably not worth worrying about.

So that’s why I am little bit confused, and not sure what to do with that.
