How to tell if the GC is running?

Tomer Filiba tomerfiliba at gmail.com
Tue Apr 8 00:57:46 PDT 2014


Etienne: I got a SEGFAULT when the runtime was trying to throw 
the exception. I can't really catch that. Is there some predicate 
I can use before I'm allocating memory?


-tomer

On Sunday, 6 April 2014 at 23:20:24 UTC, Etienne wrote:
> On 2014-04-06 5:20 PM, Tomer Filiba wrote:
>> On Sunday, 6 April 2014 at 16:34:02 UTC, safety0ff wrote:
>>> Please post more of the stack trace, it looks like you're 
>>> allocating
>>> while it is running the destructors / finalization (#11408.)
>>>
>>> https://d.puremagic.com/issues/show_bug.cgi?id=11408
>>
>> Yes, I know I'm allocating while the GC is collecting. I'm 
>> asking how to
>> avoid this situation -- is there some way to tell that the GC 
>> is running?
>>
>> -tomer
>
> If the GC is running you get a stack trace with fullcollect() 
> like this:
>
> cache-d_d.exe!gc at gc@Gcx at mark(void * this, void * nRecurse, int 
> ptop) Line 2266    C++
>      cache-d_d.exe!gc at gc@Gcx at mark(void * this, void * ptop) 
> Line 2249
>   C++
>      cache-d_d.exe!gc at gc@Gcx at fullcollect() Line 2454    C++
>      cache-d_d.exe!gc at gc@GC at mallocNoSync(unsigned int this, 
> unsigned int alloc_size, unsigned int * alloc_size) Line 458    
> C++
>      cache-d_d.exe!gc at gc@GC at malloc(unsigned int this, unsigned 
> int alloc_size, unsigned int * bits) Line 413    C++



More information about the Digitalmars-d mailing list