# FMOD\_STUDIO\_LOAD\_MEMORY\_POINT and memory lifetime

**URL:** https://qa.fmod.com/t/fmod-studio-load-memory-point-and-memory-lifetime/13441
**Category:** FMOD Studio
**Created:** [September 15, 2017, 11:05pm UTC](https://qa.fmod.com/t/fmod-studio-load-memory-point-and-memory-lifetime/13441 "2017-09-15T23:05:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@Jan](https://qa.fmod.com/u/Jan)
#### Post date: [September 15, 2017, 11:05pm UTC](https://qa.fmod.com/t/fmod-studio-load-memory-point-and-memory-lifetime/13441/1 "2017-09-15T23:05:51Z")

</div>

I am using loadBankMemory with FMOD\_STUDIO\_LOAD\_MEMORY\_POINT to prevent an unnecessary copy when loading sound banks.

To quote the fmod documentation:

"FMOD\_STUDIO\_LOAD\_MEMORY\_POINT

This differs from FMOD\_STUDIO\_LOAD\_MEMORY in that FMOD uses the memory as is, without duplicating the memory into its own buffers. Cannot not be freed after load, only after calling Studio:🏦:unload."

This implies, that after calling unload on a soundbank, the data is not used anymore and can be freed. In practice I have found this not to be the case. While shutting down my engine, fmod would regularly crash somewhere in the main fmod thread, shortly after I unloaded and released a soundbank.

Even queuing the data and keeping it around till after at least another Studio::System::update() has been called does not fix the crash. However, calling Studio::System::flushCommands() and then deleting the sound bank data seems to be working.

It would be great if you could either fix Studio:🏦:unload to actually ensure the data is definitely not going to be used after it returns, or clear up the documentation for FMOD\_STUDIO\_LOAD\_MEMORY\_POINT and mention exactly when it is save to delete.

And btw. the sentence quoted from the docs contains a typo.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [September 20, 2017, 1:15am UTC](https://qa.fmod.com/t/fmod-studio-load-memory-point-and-memory-lifetime/13441/2 "2017-09-20T01:15:18Z")

</div>

The docs could use a little bit more clarification, as found on a different page [https://www.fmod.org/docs/content/generated/FMOD\_Studio\_System\_LoadBankMemory.html](https://www.fmod.org/docs/content/generated/FMOD_Studio_System_LoadBankMemory.html)

“…the lifetime of the memory must persist until the bank has been queued for unload and then the unload has been performed. You can ensure the memory is not being freed prematurely by only freeing it after receiving the FMOD\_STUDIO\_SYSTEM\_CALLBACK\_BANK\_UNLOAD callback.”

If it crashes after the unload callback is fired, then there is an issue.

Thank you and I will get the docs updated.

---

<div class="post-metadata">

### Author: ![Jan](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@Jan](https://qa.fmod.com/u/Jan)
#### Post date: [September 27, 2017, 9:05am UTC](https://qa.fmod.com/t/fmod-studio-load-memory-point-and-memory-lifetime/13441/3 "2017-09-27T09:05:27Z")

</div>

> [@](#):
>
> The docs could use a little bit more clarification, as found on a different page [https://www.fmod.org/docs/content/generated/FMOD\_Studio\_System\_LoadBankMemory.html](https://www.fmod.org/docs/content/generated/FMOD_Studio_System_LoadBankMemory.html)
> 
> “…the lifetime of the memory must persist until the bank has been queued for unload and then the unload has been performed. You can ensure the memory is not being freed prematurely by only freeing it after receiving the FMOD\_STUDIO\_SYSTEM\_CALLBACK\_BANK\_UNLOAD callback.”
> 
> If it crashes after the unload callback is fired, then there is an issue.
> 
> Thank you and I will get the docs updated.

Great, that was the missing detail. Btw. the fmod forum could really use e-mail notifications for answers (I can’t find such a setting anywhere). Also, it’s hard to find your own posts, it’s not listed anywhere, and clicking on the name of someone just brings you to the main fmod page, instead of an overview of posts by that user.
