- Home /
How to prevent app from Crashing due to memory error?
Hello Guys,
I am facing crash issue from few days and unable to solve it. The game crashed due to "Memory Warning" after playing more than 30 minutes because of ads takes much memory. I am using Google AdMob 7.4.1 and also destroy the interstitial on closing the ad as follows:
string adUnitId = "ca-app-pub-7964334718917521/#####9";
interstitial = new InterstitialAd (adUnitId);
interstitial.OnAdClosed += HandleFullScreenOnAdClosed;
request = new AdRequest.Builder ().Build ();
interstitial.LoadAd (request);
public void HandleFullScreenOnAdClosed(object sender, System.EventArgs args)
{
interstitial.Destroy ();
interstitial = null;
Resources.UnloadUnusedAssets ();
}
But i think " interstitial.Destroy (); " is not releasing the memory just destroy the instance created. Is there any way to release the memory at runtime or any other solution. Any suggestions will be appreciated.
Thanks in Advance
Try running the profiler to check if it Really is Ads, which is hogging the memory.
Your answer
![](https://koobas.hobune.stream/wayback/20220612101636im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
iOS Memory Handling Crash on Startup 0 Answers
iOS crashing between scenes, memory problem? 0 Answers
Massive memory usage during compile time 0 Answers
Admob plugin crashing on Android 5.0 0 Answers
Help when playing in Editor , Big memory Leak/problem 0 Answers