question

Guillaume M2 avatar image
0 Likes"
Guillaume M2 asked Ryan Clark commented

Stack overflow on moveobject

Hello,

I am currently working on a project where FlexSim has to communicate with an external application. To summarize, when this application sends a message via socket, we create an flowitem in the model() (via the c++ module loaded in flexsim with a dll) then we add labels to this object and finally, we move the flowitem in a queue. As soon as the flowitem enters the queue, it generates a token in a processflow and the simulation goes on...

The problem I have now is that I have a "Stack overflow detected" error randomly when calling the moveobject function. As I say, this exception is random, I can generate a hundred objects without any problem but after a while, the exception is generated.

In the model tree, I can see is that the object is not moved in the queue (still in the root of the tree). After that the whole c++ module seems to stop working (If I don't catch the exception, the whole program crashes).

What would you recommend to avoid this mistake? I have already tried some things, whithout success :

- Use insertcopy and then destroy

- Create directly the object in the queue (but by adding the labels after, the results are not good in the simulator)


Thank you.


FlexSim 20.0.10
flexsim 20.0.10moveobjectdll errorstack overflow
· 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.

1 Answer

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Phil BoBo edited

Use a Delay activity with 0 time in order to split the processing into multiple events rather than synchronous calls on the stack.

Troubleshooting Process Flows - Using 0 Second Delays (flexsim.com)

Delay Activity (flexsim.com)

· 2
5 |100000

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