digitalmars.D - How to destroy a big Array and free RAM
- Giovanni Di Maria (11/11) Dec 12 2018 How to delete an array and to free RAM
- NX (16/21) Dec 12 2018 Destroying and free-ing are not the same thing. Since D is a
- Giovanni Di Maria (4/27) Dec 12 2018 Hi NX
How to delete an array and to free RAM Hi. Can you help me please? I have tried many experiments but without success. I have a big array of arrays (matrix[][]). After to have filled of data i measure the RAM with an utility (for example Wise Memory Optimizer). Then i try to destroy the array in many modes, but the free RAM is still the same. Can you help me please? Thank you very much Giovanni Di Maria
Dec 12 2018
On Wednesday, 12 December 2018 at 08:14:57 UTC, Giovanni Di Maria wrote:How to delete an array and to free RAM After to have filled of data i measure the RAM with an utility (for example Wise Memory Optimizer). Then i try to destroy the array in many modes, but the free RAM is still the same.Destroying and free-ing are not the same thing. Since D is a garbage collected language you probably want to do something like this: import std.stdio; import core.memory; void main() { long[][] array = new long[][](1024, 1024); writeln(GC.stats); destroy(array); GC.collect(); // Mark & Sweep GC.minimize(); // Free unused memory writeln(GC.stats); }
Dec 12 2018
On Wednesday, 12 December 2018 at 08:29:45 UTC, NX wrote:On Wednesday, 12 December 2018 at 08:14:57 UTC, Giovanni Di Maria wrote:Hi NX Thank you very very much. GiovanniHow to delete an array and to free RAM After to have filled of data i measure the RAM with an utility (for example Wise Memory Optimizer). Then i try to destroy the array in many modes, but the free RAM is still the same.Destroying and free-ing are not the same thing. Since D is a garbage collected language you probably want to do something like this: import std.stdio; import core.memory; void main() { long[][] array = new long[][](1024, 1024); writeln(GC.stats); destroy(array); GC.collect(); // Mark & Sweep GC.minimize(); // Free unused memory writeln(GC.stats); }
Dec 12 2018