# PluginDirectoryScanner crashes when it scans more than ~800 VST3 from a folder

**URL:** <https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097>\
**Category:** General JUCE discussion\
**Created:** [April 27, 2024, 4:28am UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097 "2024-04-27T04:28:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![5amx](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/5amx/32/15089_2.png) [@5amx](https://forum.juce.com/u/5amx)\
**Post date:** [April 27, 2024, 4:28am UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/1 "2024-04-27T04:28:11Z")

</div>

Hi Juce Forum, please help me with this issue.

I’m creating a scanner that scan VST3 plugins from a folder with PluginDirectoryScanner and scanNextFile. It works well, but when I scan a folder that has a lot of VST3 files (about 800 or more) it crashes.

This is the error that is happening on file juce\_VST3PluginFormat. As you can se it is related with CFBundleLoadExecutableAndReturnError.

 ![Screenshot 2024-04-26 at 10.24.54 p.m.](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/d/9/d966361539290b26949a87a5e40181e9a0bd7a15.jpeg)

This is what appears in console as an error:

dyld[5473]: could not create thread local variables pthread key  
libc++abi: cannot create thread specific key for \_\_cxa\_get\_globals()

Any guess what it can be? Thanks in advance for your kindly help!

---

<div class="post-metadata">

**Author:** ![railjonrogut](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/railjonrogut/32/505_2.png) [@railjonrogut](https://forum.juce.com/u/railjonrogut)\
**Post date:** [April 27, 2024, 7:33am UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/2 "2024-04-27T07:33:13Z")

</div>

Does it crash in Release as well as Debug? Protected plugins will crash the debugger.

Rail

---

<div class="post-metadata">

**Author:** ![baconpaul](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/baconpaul/32/8403_2.png) [@baconpaul](https://forum.juce.com/u/baconpaul)\
**Post date:** [April 27, 2024, 10:36pm UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/3 "2024-04-27T22:36:43Z")

</div>

Loading 800 vst3 plugins in one process might just simply have run you out of memory. Anything like that seem to be the case?

---

<div class="post-metadata">

**Author:** ![5amx](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/5amx/32/15089_2.png) [@5amx](https://forum.juce.com/u/5amx)\
**Post date:** [April 29, 2024, 6:21pm UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/4 "2024-04-29T18:21:09Z")

</div>

Thanks for your reply.

Unfortunately no, it crashes even in release version. I think it’s related to a memory issue that cannot handle to scan a lot of plugins. I’m checking what I can do.

---

<div class="post-metadata">

**Author:** ![5amx](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/5amx/32/15089_2.png) [@5amx](https://forum.juce.com/u/5amx)\
**Post date:** [April 29, 2024, 6:22pm UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/5 "2024-04-29T18:22:20Z")

</div>

I think the same, even in Release version is happening the crashing. Do you have any idea what I can modify to increase the memory involved?

---

<div class="post-metadata">

**Author:** ![baconpaul](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/baconpaul/32/8403_2.png) [@baconpaul](https://forum.juce.com/u/baconpaul)\
**Post date:** [April 29, 2024, 6:34pm UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/6 "2024-04-29T18:34:33Z")

</div>

So I think most folks who make reliable scanners end up realizing they have to do them out of process with a sub process that does n at a time and records the done ones. I don’t know if there’s another answer especially if some vsts have big load time footprints

---

<div class="post-metadata">

**Author:** ![haroldgroenenboom](https://avatars.discourse-cdn.com/v4/letter/h/8c91f0/32.png) [@haroldgroenenboom](https://forum.juce.com/u/haroldgroenenboom)\
**Post date:** [November 5, 2026, 8:55am UTC](https://forum.juce.com/t/plugindirectoryscanner-crashes-when-it-scans-more-than-800-vst3-from-a-folder/61097/7 "2026-11-05T08:55:42Z")

</div>

I’ve ran into this as well, and apparently (if I understand it correctly) pthread has a max amount of thread local keys available for thread local variables (`PTHREAD_KEYS_MAX`), so if dynamic libs are never unloaded while they do use thread locals, pthread will eventually reach the max key count.
