Am 07.02.2012, 22:15 Uhr, schrieb Iain Buclaw <ibuc...@ubuntu.com>:

  o  zero out a memory block     <---------- !!!

What about these functions?


import std.array;

byte[][ALLOCS] a, b;

writeln("** uninitializedArray!(ubyte[])(1024*1024)");
foreach(i; 0 .. ALLOCS) b[i] = uninitializedArray!(ubyte[])(1024 * 1024);
prev = print_ressources(&prev);

writeln("** minimallyInitializedArray!(ubyte[])(1024*1024)");
foreach(i; 0 .. ALLOCS) c[i] = minimallyInitializedArray!(ubyte[])(1024 * 1024);
prev = print_ressources(&prev);



Regards


Yeah I know these and used them, only to find out the program I am porting relies on the data beeing zeroed out (it is a certain type of compression utility). It's a shame to see the C version get away with a low memory footprint _and_ zero initialized buffers. I'll just copy the 'Array' class from the original then, that uses calloc and free.

Reply via email to