When I do a "new" in a struct constructor to assign to a member variable of this struct, what do i write in the same struct destructor to free the memory ?
Thread overview | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 15, 2021 struct destructor | ||||
---|---|---|---|---|
| ||||
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | On Saturday, 15 May 2021 at 16:52:10 UTC, Alain De Vos wrote: >When I do a "new" in a struct constructor to assign to a member variable of this struct, what do i write in the same struct destructor to free the memory ? If you used |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Saturday, 15 May 2021 at 16:53:04 UTC, Adam D. Ruppe wrote: >On Saturday, 15 May 2021 at 16:52:10 UTC, Alain De Vos wrote: >When I do a "new" in a struct constructor to assign to a member variable of this struct, what do i write in the same struct destructor to free the memory ? If you used Can I send a kind message to the garbage collector to please free that speficic memory at that time specified ? |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | Feature request, a function old which does the opposite of new, allowing deterministic,real-time behavior and memory conservation. |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | On Saturday, 15 May 2021 at 17:55:17 UTC, Alain De Vos wrote: >Feature request, a function old which does the opposite of new, allowing deterministic,real-time behavior and memory conservation. You can use object.destroy to destruct, and GC.free to free memory allocated with |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dennis | Thanks, good idea but, |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dennis | On Saturday, 15 May 2021 at 18:15:24 UTC, Dennis wrote: >On Saturday, 15 May 2021 at 17:55:17 UTC, Alain De Vos wrote: >Feature request, a function old which does the opposite of new, allowing deterministic,real-time behavior and memory conservation. You can use object.destroy to destruct, and GC.free to free memory allocated with Specifically you wanna do:
|
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | Sorry free does , indeed. |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alain De Vos | On Saturday, 15 May 2021 at 17:55:17 UTC, Alain De Vos wrote: >Feature request, a function old which does the opposite of new, allowing deterministic,real-time behavior and memory conservation. You're best off doing malloc+free if you want complete control though. |
May 15, 2021 Re: struct destructor | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | I'll try first the first tip of Adam, here the code,
|