Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Element Collections Example

2020-11-17
2020-12-09
  • andras-mozes - 2020-11-17

    Hello,

    in the SimpleQueueExample there is the following NOTEs.
    aElements : ARRAY[0..9] OF COL.IElement; // Create an array of IElements for a static queue. NOTE: The size must be 2 times larger than the maximum number of used elements.

    queue : COL.Queue := (paElements := ADR(aElements), udiMaxElements := 10); // Created a static queue. NOTE: Static created elements of this queue will be online change safe.

    What does The size must be 2 times larger than the maximum number of used elements. exactly mean?

    Is it true?

    Thanks for the help in advance.

     
  • stmos - 2020-12-09

    Same question here...

    From my tests it seems also that if I try to fill the queue it gives the "Max size exceeded" error with the exact size of the array.

    So it seems that there is no need to have an underlying array 2 times the max size, but I'm concerned with possible memory overflows...

     

Log in to post a comment.