Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Out of retain Memory _ TwinCat3

    Out of retain Memory _ TwinCat3

    RedOne
    Established Member

    Hello,

    Did anyone had this problem before, to run out of retain memory, for a Control Plus project ?

    Is it possible to change the allocated memory, in TwinCat? If yes, how can I do this, and how can I check, if by increasing this memory size I'm not overlapping a different part of the memory? And last thing, is it recommended to change it, or I should find a workaround? 

    Thanks! 

    4 REPLIES 4

    nexidator
    Community Moderator
    Community Moderator

    Is the variable declared as RETAIN or as PERSISTENT (or even both)? TwinCAT behaves different than CoDeSys (or IndraLogic) concerning these keywords. With all TwinCAT target systems supported by Control plus, it is never necessary to declare a variable as RETAIN. With TwinCAT, RETAIN variables are linked to a NOVRAM hardware memory. Instead, just use PERSISTENT and the variables will be persisted on the Windows file system.

    RedOne
    Established Member

    Hi. They are declared both as persistent and retain. So this must be the problem. I will use only persistent, and I will test next week. I will comeback with a feedback, once I will test your solution. Thank you! You're the best! 😁😎

    SteffenR-
    Community Moderator
    Community Moderator

    Short answer:

    Do not use RETAIN in Control plus, only use PERSISTENT. It covers all cases to keep the values (execpt Reset Origin). 
    [December 2021]

    Long answer:

    RETAIN saves the variables in the NVRAM / NOVRAM. The Beckhoff target systems supported by Control plus do not have/need a NOVRAM. An example with included NOVRAM would be the CX9020.
    This NOVRAM is limited in its size and causes your error.
    In TwinCAT the declaration with RETAIN is not enough (whereas in IndraLogic/ctrlX/CODESYS it should be enough). In TwinCAT you additionally have to link the RETAIN variables like IO variables with the NOVRAM:

    SteffenR_1-1638542173618.png

    Overview of the behaviour in Control plus:

     
    Command VAR VAR RETAIN VAR PERSISTENT
    Reset warm
    (not available in TwinCAT)
      x x
    Reset cold
        x
    Reset origin      
    Download     x
    Online change x x x

     

    In ctrlX there is a special case (task-local GVL) where you even must not use RETAIN and PERSISTENT together: Link

     

    General documentations:

    TwinCAT 3

    ctrlX  (quite extensive)

    CODESYS 3

    RedOne
    Established Member

    Thanks Steffen! very useful information! 😁 

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist