Invalid or deleted object error after long run in App Designer
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Please see attached file MSG_5.mlapp developped in App Designer. It just calculates numbers and save solutions in a file.
It is supposed to run for given duration (seconds, minutes, hours, and days). Ideally, it must keep on calculating for 20 days.
All seems well on short runs, i.e upto 15 hours. However, on long runs, i.e 17, 20, 27 hours, the code crashes in line 3282.
I can't figure out why the error Invalid or deleted object erupts suddenly after as duration goes on.
To operate this App:
- Click Reference Data button to uphold input data. See attached file MSG_4_Quintuplets_Table_NonZero.mat. Do not rename.
- Set duration and unit
- and Click on AUTOMATE button
When a solution is detected, the App generates a file called MSG_5_solutions_level_1.mat and saves the solution in it.
I will really appreciate if somebody helps me debug this error.
Thanks
2 commentaires
Réponse acceptée
Shivam
le 20 Mar 2024
I understand that you are dealing with a long-running app that leads to a crash when the app's running time goes beyond 15 hours.
Upon reviewing the error and the amount of time the app runs, I find the memory issue in this case. (I ran the app for around an hour, which didn't lead to any crashes). It is important to note that long-running applications performing calculations and data manipulations can consume increasing amounts of memory over time. And, when the system starts running low on memory, it might start behaving unpredictably, which can lead to data loss (here, the app object getting deleted).
While there may not be a single solution to this issue, I have outlined a few recommendations that could help identify and resolve the problem:
- Debug the app by checking before line 3282, confirming if the app object is still in the MATLAB workspace.
- Ensure that no part of the code explicitly deletes or clears the object associated with app.solution_matrix. This includes using delete, clear, or close functions in the code. Also, check if the app object handle is not overwritten.
- Monitor the application's memory usage over time to see if there is a memory leak/memory leak spike before the crash. You can use the MATLAB profile command to start profiling the session, which can help identify memory usage.
You can refer to the following MATLAB answer to know more about profiling MATLAB memory usage:
I hope it addresses your query.
Thanks
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!