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
Thank for your reply.
Actually the stMain has many big sized stSub members (stSub1~stSub1024) and in most cases only 1~2 of them are used depending on user configuration.
static declaration of sub structs results in more than 500mb memory allocation for them. so this is only for reducing memory usage.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I have two sturcts, stMain and stSub.
stSub is contained in stMain and both structs are dynamically created using __NEW.
if I delete stMain, is stSub automatically deleted? or Should i delete stSub first and then delete stMain?
Last edit: audi0615 2021-04-17
No, it is not deleted.
But why do you require a struct that has a pointer to struct? Couldn't you just embed stSub in stMain as a member?
Thank for your reply.
Actually the stMain has many big sized stSub members (stSub1~stSub1024) and in most cases only 1~2 of them are used depending on user configuration.
static declaration of sub structs results in more than 500mb memory allocation for them. so this is only for reducing memory usage.