simulink opens multiple windows of model at startup, takes very long, and almost always freezes (uses ~all memory at startup)

20 views (last 30 days)
Hi all,
I have a model that started opening several versions of itself at startup (several windows of the same model). I have been working on it for +2 months now, always copy pasting blocks (ctrl+c ctrl+v) from older version of the model, pasting them in a new blank model with a new name from time to time. It used to open f.e. 3 windows of the same model, took some time, but i could always run the model with no problem. Now, it opens up 5-7 windows, takes a lot of time to load, and freezes in the end.
The model blocks have quite some initialization code, dynamic mask editing, masks that allow the user to change things in the blocks, f.e. dynamic # of input/output ports selection for a block, visualization of blocks that change depending on parameters. Most of the initialization code actually refers to stand-alone matlab scripts, that create data in the background (f.e. checking which connections were made with wich blocks, writing this data into matrices). The model is actually just an "front-end" interface for a user, where in the background data is created that is then afterwards (separate action, not done in simulink) used in a matlab script.
I experimented a bit, by putting the model in a separate folder, changing the matlab path to the folder were it originally was (along with all the stand-alone matlab scripts), then opening the model (from it's seperate location). This actually helps to open the model, it still takes quite some time, but it doesn't freeze. I don't feel like it is a bullet proof solution however, since this also seems to start getting slower and slower...
I monitored my CPU/memory usage when opening the model, and I saw that almost all of my memory is used during the process of opening, and CPU also peaks sometimes to max, but not as continuously as the memory: below a screenshot of the memory when the model came out if it's 3/4min freeze at startup (and it got working).
I need to figure out what is causing the freezing/slow load time, since other users will need to work with the model, and might not have the same patience as I have.
Thanks in advance for your help!
  1 Comment
Aakhilesh Singhania
Aakhilesh Singhania on 20 Jan 2021
Hello,
Do you have a script called startup in the project folder you are starting from ?
If so Matlab tries to run the script when you start Matlab, I had a similar problem, renaming the script solved my problem.

Sign in to comment.

Answers (1)

Andy
Andy on 18 Oct 2022
I've been having this same issue now for a couple weeks, and the assocated refresh time just for moving a window is killing me (assuming the double open and slow refresh are related). I'm getting ready to open a ticket, I think.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!