Why does "parsim" or "batchsim" with a postSimFcn that accepts a SimulationInput cause an "out of memory error during serialization" error?
조회 수: 4 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2022년 10월 5일
답변: MathWorks Support Team
2022년 10월 5일
I am attempting to run simulations using "parsim" or "batchsim". I notice that the simulations take up an extraordinarily large amount of memory, significantly more than what would be expected from their input and output data. Then I receive the error:
"out of memory during serialization"
채택된 답변
MathWorks Support Team
2022년 10월 5일
The issue is triggered by passing a SimulationInput object as an argument to a postSimFcn:
>>SimIn(idx) = SimIn(idx).setPostSimFcn(@(x) postsim(x, SimIn(idx)));
Using the SimulationInput object as an input argument of the anonymous function in this callback can cause a circular reference which led to runaway memory usage during the serialization of parsim and batchsim initialization.
A workaround is to use a temporary variable for the SimIn element instead of passing the simulation input object itself.
>>tmpSimIn = SimIn(idx);
>>SimIn(idx) = SimIn(idx).setPostSimFcn(@(x) postsim(x, tmpSimIn));
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Run Multiple Simulations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!