On Friday, 21 December 2018 at 22:31:26 UTC, Steven Schveighoffer wrote:
On 12/21/18 3:41 PM, Giovanni Di Maria wrote:
[...]

Note: alloca is a builtin intrinsic, so I wouldn't use that as a function name. Don't think it's affecting your program, but I wanted to point that out.

 [...]

This does NOT free the ram, it simply resets vec to null.

If you want to free the memory, use

GC.free(vec.ptr); vec = null;

 [...]

Note, this allocates a lot of smaller arrays on its way up to the really big array. You are better off doing:

vec.reserve(5_000_000);

which will pre-allocate the capacity needed. This will make you only allocate once.

-Steve







Hi Steve
Ok, thank you very much.
Ciao
Giovanni

Reply via email to