Basic functionality without GC
Vladimir Kulev
me at lightoze.net
Thu Sep 28 06:50:03 PDT 2006
Why basic functionality like associative arrays needs GC to be run,
otherwize cause memory leaks? For example, the code below slowly raise
memory usage if you don't call std.gc.fullCollect.
Generally, I have the following proposals about phobos organization:
1) Make all basic functions working with and without GC enabled.
2) Separate phobos runtime from phobos userland functions. Preferably into
different packages like "phobos." and "std.". Make first to be independent
from second, even if duplication of some functions is needed.
What do people think about this?
Sample code:
private import std.stdio;
private import std.gc;
private import std.c.time;
int main() {
int[ int ] a;
while ( true ) {
a[ 1 ] = 1;
a.remove( 1 );
usleep( 10000 );
writefln( "..." );
// fullCollect();
}
return 0;
}
More information about the Digitalmars-d
mailing list