Memory profiling an app designer app?

12 次查看(过去 30 天)
Ken
Ken 2024-4-23
回答: Tiffany 2024-5-30
My app designer app has a memory leak. I don't understand how this would happen, because I have only a finite number of array variables, and I assume that when the data in one of these is replaced, the old data are flushed and garbage collected. Right?
But anyway, I need to do memory profiling and see when the upticks in usage are happening. The documentation I can find mostly refers to profiling for speed, and profiling small chunks of code. How do I profile for memory, and watch the whole app? (Or sprinkle memory usage checkpoints throughout my code?) And an old third-party post I see a reference to a built in command memory, but it seems to no longer exist, it gets an error "Function MEMORY is not available on this platform." (I'm using a Mac.) Is there a new command that replaces it?
  1 个评论
Ken
Ken 2024-4-27
A call to tech support got me the information that they fixed a known memory leak bug as of R2023b Update 6. R2024a is clean.
So I didn't learn how to do memory profiling, but it probably wouldn't have helped since the bug was beyond my control anyway.

请先登录,再进行评论。

回答(1 个)

Tiffany
Tiffany 2024-5-30
Hi Ken,
I'm happy to hear that you were able to pinpoint the issue through tech support. Just in case you're still interested in memory profiling your App Designer application, you can use MATLAB profiler. To do so:
1. Begin the Profiler by entering the following in the MATLAB command window:
>> profile on -memory
2. Run and interact with your app.
3. Stop the Profiler:
>> profile off
4. View the Profile Summary, which should include information about allocated memory, freed memory, peak memory and so forth:
>> profile viewer
For more information on profiling your code to improve performance, please view:
Additionally, to learn more about how MATLAB allocates memory, please view:
I hope the above helps!

类别

Help CenterFile Exchange 中查找有关 App Building 的更多信息

产品


版本

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by