App Designer shuts down when processing big files

I have an app that processes .tif files in different resolutions. It compares two images printed on two different printers to check colour differences.
This is done by plotting all the pixels on 2D and 3D axes in LAB spaces, and variables like Delta E are calculated for each pixel.
Now I am processing relatively large images (100 MB). When processing smaller images, everything works fine. When I process these 'big' images, the app closes itself during the calculations. The only error I get is that the next step cannot be executed anymore ("Invalid or deleted object")
Is this a known behaviour of App Designer, that an app shuts itself off when too much needs to be calculated/plotted? As there are no error messages to learn from, I have no idea where it goes wrong...
As it works fine for other files, I assume the code on itself isn't faulty, but there must be something that shuts down the app?

5 Comments

dpb
dpb on 31 May 2022
Edited: dpb on 31 May 2022
I'm sure there's nothing builtin by TMW of that sort...
The klew is the error that the code is trying to reference a deleted/invalid object -- there's a data-dependent issue going on here, I'd bet--the result of some operation isn't what your code is expecting -- like a find operation returned an unexpected empty object reference and so some expected action didn't occur. Knowing nothing more, there's little specific can say.
There must be some reference in the code as to where that reference comes from; set breakpoint in that area of the code and observe the code execution to get there -- probably will uncover a "gotcha!" you hadn't anticipated.
Other way to approach is to sprinkle the code with a bunch of diagnostics outputs to indicate where the code has gotten to -- this is somewhat problematical with a compiled app which doesn't have a console so use the interactive F5 route in the designer that runs interactively.
This is the error
Invalid or deleted object.
Error in AnalogDigitalTool/CalculateButtonPushed (line 726)
app.TabGroup.SelectedTab = app.DataTab;
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating DestroyedObject PrivateButtonPushedFcn.
The error is related to the last line of below code.
The action before it is using the CalculateVisuals() function, and I get progress bars showing that these calculations are working fine. I would excpect that the try-catch structure would show me if anything is going wrong within this function, but it doesn't show any messages.
However, than the next action, which is just a simple tab selection, cannot take place because the app is closed of ("by itself", it seems) .
% Execute calculations
try
CalculateVisuals(app)
catch ME
message = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
uialert(app.UIFigure, message, "Error", "Icon", "error");
end
%Confirmation
app.TabGroup.SelectedTab = app.DataTab;
The last lines within the CalculateVisuals() function are
d.Value = 1;
d.Message = "Calculations finished";
drawnow;
pause(0.5);
close(d);
I see the message appearing (d is a uiprogressdlg), so that must mean the code has been working up till then. If there is no issues up till the last line of the function, but the tab selection gives an error, should the error than be in the catch module?
I commented out the try-catch structure, but it didn't solve the problem.
It's telling you the value of app.DataTab has been corrupted -- set a breakpoint at that line and examine it. Somewhere that has been overwritten or deleted accidentally.
I've never used tabs so don't know the details of the addressing/selection -- is app.DataTab a use constant that contains a desired tab name/number I presume? Can set breakpoint on its value change?
I tried working with breakpoints but it didn't give more information. Steps just worked fine and then out of nowhere it shut down again.
What is even weirder is that on some occasions, the calculations did go through, while on other moments exactly the samen calculations blocked again. So maybe it has more to do something with the Matlab usage of the cores and allocation of memory or something like that.
The app.DataTab is just a reference to one of the tabs in the tab group. This command just tells the GUI to show that tab in front (as if you as a user would click on the tab header to switch to that tab).
I think you would have to send the app and data file(s) that cause the problem to TMW with an official support request -- not much anybody here can do as it is certain it is not an intended/design feature within AppDesigner.
Have you the facility to be able to try another machine/installation to see if is reproducible?
It sounds most like the exhaustion of a system resource; it's always possible even if unlikely your specific code has uncovered a memory leak or HG2 handles leak or somesuch...
Have you watched system monitor during execution?

Sign in to comment.

Answers (0)

Categories

Products

Release

R2019b

Asked:

on 31 May 2022

Commented:

dpb
on 9 Jun 2022

Community Treasure Hunt

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

Start Hunting!