Pop quiz [memory usage]

bearophile bearophileHUGS at lycos.com
Sat Jun 6 06:17:10 PDT 2009


Vladimir Panteleev:
> 	// QUESTION: How much memory will this program consume upon reaching this  
> point?

There's some serious bug here. It allocates 40+ MB.

The following code even crashes LDC during the compilation, I'll ask in the LDC channel:

struct S { ubyte[40_000] d; }
void main() {
    S[] a;
    a ~= S();
}

Bye and thank you for the little test,
bearophile



More information about the Digitalmars-d mailing list