Thread overview
Bug : GC can't allocate a large buffer
Jan 05, 2004
yaneurao
Jan 06, 2004
yaneurao
Jan 22, 2004
Walter
Jan 23, 2004
yaneurao
January 05, 2004
In Win9x , GC can't allocate large buffers like this.

byte [] v = new byte[4096*256];

GC can't allocate this. Somebody said something is wrong with GC, but I don't think so.

When allocPage is failed , fullcollect would be called.
GetThreadContext in fullcollect returns FALSE.
and make an assert failure.

: Thread t = threads[n] ;
: if( !GetThreadContext( t.hdl, &context ) ){
:@@assert(0) ;  // here
: }

Obviously t.hdl is the duplicated handle made by calling
getCurrentThreadHandle() from Thread.this() in std.thread.

But getCurrentThreadHandle can't duplicate this.
After DuplicateHandle is called, GetLastError says 'invalid handle' in Win9x.
(Now I can't guess why it is..)

That's all why GC can't allocate and GC looks to have a failure. It is a very serious problem , I think. Fix required.

yaneurao.


January 06, 2004
In article <btcaa0$a6f$1@digitaldaemon.com>, yaneurao@sun-inet.or.jp says...
>In Win9x , GC can't allocate large buffers like this.

I've got to the back of it.

getCurrentThreadHandle in std.thread ,

> thread_hdl currentProcess = cast(thread_hdl)-1 ; // here has a problem

< thread_hdl currentProcess = GetCurrentProcess() ;

I don't know what 'cast(thread_hdl)-1' means...

yaneurao.


January 22, 2004
<yaneurao@sun-inet.or.jp> wrote in message news:btdpq3$2i0a$1@digitaldaemon.com...
> In article <btcaa0$a6f$1@digitaldaemon.com>, yaneurao@sun-inet.or.jp
says...
> >In Win9x , GC can't allocate large buffers like this.
>
> I've got to the back of it.
>
> getCurrentThreadHandle in std.thread ,
>
> > thread_hdl currentProcess = cast(thread_hdl)-1 ; // here has a problem
>
> < thread_hdl currentProcess = GetCurrentProcess() ;
>
> I don't know what 'cast(thread_hdl)-1' means...

Perhaps it would make more sense if written:
    cast(thread_hdl)(-1)


January 23, 2004
In article <bup47g$2o3v$2@digitaldaemon.com>, Walter says...
>> >In Win9x , GC can't allocate large buffers like this.
>> > thread_hdl currentProcess = cast(thread_hdl)-1 ; // here has a problem
>> < thread_hdl currentProcess = GetCurrentProcess() ;
>> I don't know what 'cast(thread_hdl)-1' means...
>Perhaps it would make more sense if written:
>    cast(thread_hdl)(-1)

I couldn't understand it for a moment ,
since MSDN in Japanese doesn't say anything about it.
after , I found the following description MSDN in English.

: A pseudo handle is a special constant, currently (HANDLE)-1, that is interpreted as the current process handle. For compatibility with future operating systems, it is best to call GetCurrentProcess instead of hard-coding this constant value.

it is just what I want to say! (HANDLE)-1 should not be used.
in Win9x at least Japanese Edition ,
it is fact that calling DuplicateHandle with currentProcessHandle being -1
will fail. and that's why GC in D can't allocate a large buffer in Win9x.

yaneurao.