new(malloc) locks everything in multithreading

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 24 02:15:30 PDT 2014


On Friday, 24 October 2014 at 09:12:57 UTC, tcak wrote:
> On Friday, 24 October 2014 at 08:55:17 UTC, Kagamin wrote:
>> Do you see recursive call to malloc in the stack trace?
>
> I further simplified the example:
>
> import std.stdio;
> import core.thread;
>
> class ThreadTest{
> 	public this(){
> 		new core.thread.Thread( &threadRun ).start();
> 	}
>
> 	private void threadRun(){
> 		writeln("It works");
> 		readln();
> 	}
> }
>
>
> void main(){
> 	new ThreadTest();
> 	char[] abc = new char[4096];
> }
>
>
> This is what I see on screen:
> http://imgur.com/Pv9Rulw
>
> Same result.

And this is the thread of malloc.
http://imgur.com/e8ofRte

It suspends all threads and cannot get out of there it seems like.


More information about the Digitalmars-d-learn mailing list