Invalid or deleted object error after long run in App Designer

2 views (last 30 days)
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:
  1. Click Reference Data button to uphold input data. See attached file MSG_4_Quintuplets_Table_NonZero.mat. Do not rename.
  2. Set duration and unit
  3. 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 Comments
Cris LaPierre
Cris LaPierre on 18 Mar 2024
Is there more to the error messgae? Please share all the red text.
Dominique
Dominique on 19 Mar 2024
Edited: Dominique on 19 Mar 2024
Hi @Cris LaPierre, here is the snippet of the error message:
Invalid or deleted object.
Error in MSG_5/AUTOMATEButtonPushed (line 3282)
current_height_level1 = height(app.solution_matrix);
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating DestroyedObject PrivateButtonPushedFcn.

Sign in to comment.

Accepted Answer

Shivam
Shivam on 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
  1 Comment
Dominique
Dominique on 21 Mar 2024
Thank you very much for taking time to check this issue.
I'm going to investigate it using MATLAB Profiling.
Thanks.

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!