simulink opens multiple windows of model at startup, takes very long, and almost always freezes (uses ~all memory at startup)
14 views (last 30 days)
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!
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.