problem with gc?

zhmt via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 27 01:27:08 PDT 2015


>> 
>> What happened when the code changes a little? Who will give an 
>> explaination,Thanks a lot?
>
> what happend if you use sformat instead?
>
> Ptr!Conn conn = connect("127.0.0.1",8881);
> ubyte[100] buf;
> char[100] buf2;
> for(int i=0; i<N; i++)
> {
> 	auto str = sformat(buf2, "%s",i);
> 	conn.write((cast(ubyte*)str.ptr)[0..str.length]);
> 	conn.read(buf[0..str.length]);
> 	n++;
> }
> conn.close();

@Daniel Kozák
Thanks for reply.

I have tried sformat, but it doesnt work: throughput falls down, 
and the cpu keeps busy.


More information about the Digitalmars-d-learn mailing list