On Monday, 11 May 2015 at 09:20:50 UTC, Daniel Kozák wrote:
On Mon, 11 May 2015 09:09:07 +0000
tcak via Digitalmars-d-learn
<digitalmars-d-learn@puremagic.com> wrote:
I think synchronize(this) prevents GC from collect memory
I am not sure whether this is expected behaviour from
`synchronization` keyword.
Similar code in Java. It has settled on about 62M and didn't
increase at all.
[code]
public class Main{
private void other(){}
public void close(){
synchronized( this ){
other();
}
}
public void hasData(){ System.out.println("Has Data"); }
public static void main( String[] args ){
for(long i=0; i < 250000000; ++i){
Main conn = new Main();
conn.hasData();
conn.close();
conn = null;
}
}
}
[/code]