question

Fabio G10 avatar image
1 Like"
Fabio G10 asked Fabio G10 commented

Speed and Memory downgrading during long time simulation process

Hi all, we have a complex model and we need to improve the actual speed (during all simulation) to get the result & stats faster

Below the explanation and a few questions…


Model

Model which manages around 20 cranes and other Task Executers (railcars in paths, transfer cars, etc), around 20,000 objects at a time (boxes) and a lot of code with logic.

We are creating the 3D objects through the process and after some processing they disappear (it ends up in a Conveyor, connected to a Sink object) .

We have only a few and light Dashboards with few data.

We have a lot of Global Variables (around 200), but mainly of integer type

This model needs to run around 10 real hours or more to get the results we need.

The firsts hours, model consume around 1.5 Gb RAM (windows task manager) and run at real speed of 1000 X average


Hardware: Core i7 13th, 32 Gb RAM, NVidia RTX 4050

Flexsim: 23.1.2


Problem

As the hours go by, the memory grows and the real speed of the simulation decreases

After 12 hours, we have around 18 Gb RAM (task manager) and real simulation speed drops to around 100 X


We need to increase the actual speed to improve the total simulation time (get the results faster)


We have checked

Memory Profile: ~500 Mb summing all items in snapshot. Where are the other 17 Gb ? Could be accumulating information in somewhere ?

Performance Profiler: recording around real 100 seconds —> 58 sec consumed are reported. Where are the other 42 sec ? Is 3D drawing tasks or something ?

TreeNode: we have checked token count in all process flows and remain stable like at the simulation start (not growing token count)

GlobalList: not cumulating items. Remaining stable.

Tables: not cumulating rows. Remaining stable.


Questions

1. What else can we check to ensure model speed remains stable through all the simulation ? Could have accumulation of objects or data in other places in the model ?


2. Can we force some memory flush (garbage collector or someting) for freeing up memory?


3. Are the 3D objects destroying really at the conveyor connected with the Sink ? Or the objects could be accumulating and are not visible ?


Thanks!

FlexSim 23.1.2
objectsmodel speedmemory leakrunning time
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·

Your statical data increases while you run a model. All objects collect data. It is not important if you show it in a chart or not, it is available in the tree. If you absolutely sure you do not need statistical of unimportant objects you can try to reset statistical data of those objects.

You can also export data for example to an excel table and delete exported data from your model.
In the past there existed for 3D sinks an option to recycle used items. I’m not aware if it is still so.
You could implement something similar, if you don’t delete items rather than to erase all individual data and reuse them later again. But you must be aware of that there exists coupled data to modules like warehouse and conveyors.

You can let run a model without an opened 3D view.

0 Likes 0 ·
Fabio G10 avatar image Fabio G10 Joerg Vogel commented ·
Thank you Joerg, I will check the reset option on certain unimportant objects. i will explore reusing objects too.


These object stats that you mentioned for example on simple 3D objects like a Box is data which is accumulating or only general stats ? How can I check these ? Thanks
0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Fabio G10 commented ·
@Fabio G10, You can test it and build a simple model.

hit several times in memory profiler: take snapshot and compare colored surfaces.

test large amount of items increasing or static amaount stable.
test dashboard data over time.

20k items are around 130 MB.

Dashboard data increases while model runs.


0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Hi @Fabio G10,

We haven't heard back from you. Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·
Fabio G10 avatar image Fabio G10 Jason Lightfoot ♦ commented ·
Hi Jason.. I'm working on optimizing my model: checking code, eliminating unused tokens, reusing objects.. so I think the problem is the sum of small things that I need to continue optimizing. About the memory issue, it seems Flexsim (or Windows) frees unused memory when stopped or when system needs it. I'm continue working on this (I will accept the answer). If I have something new in the next days, I will reopen the case. Thanks for your help !
0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Fabio G10 commented

Please use the memory profiler to see where the memory is being used in the model.

Use the performance profiler to see why the model is slow.

You can disable stats collectors if they are the cause of consuming too much memory through constant data collection.

Do you have any errors in your system console? If you do that could indicate an issue which conceivably could leak memory (a guess).

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Fabio G10 avatar image Fabio G10 commented ·

Thank you Jason. i've tried profilers and I couldn't detect any issue. I will come back on it to check with more detail. System is not showing errors. My guess is there is data collecting or accumulating on dead tokens, 3d objects, items used previously in lists or something that is hidden to us (or perhaps I can't find the way to see it) or 3d objects that are not really destroyed and stay consuming data.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.