[Gc] Re[2]: Avoid ABORT() in GC_log_printf

Kjetil Matheussen k.s.matheussen at notam02.no
Tue Nov 20 10:18:14 PST 2012


Hi,

Maybe a configure option, like --ignore-abort, would be a good idea.
Also, I think it's quite drastic to call abort in GC_log_printf. The 
message
I get from GC is this:

GC Warning: Repeated allocation of very large block (appr. size 
397312):
	May lead to memory leak and poor performance.

I haven't tracked down why I get this warning, but it hasn't been
a problem, as far as I know. At least it shouldn't kill the program if
the output itself fails. It's quite common for applications to
run in a read-only directory.

What about replacing

     if (WRITE(GC_log, buf, strlen(buf)) < 0)
       ABORT("write to log failed");

with

     GC_ASSERT(WRITE(GC_log, buf, strlen(buf) >= 0);

?


On 20.11.2012 18:41, Ivan Maidanski wrote:
> Hi
>
> Ok, I see the problem but what are the solutions possible?
>
> Regards,
> Ivan
>
> Tue 20 Nov 2012 18:00:48 Kjetil Matheussen :
>
>> Hi Ivan,
>>
>> Thanks for quick reply!
>> And thanks for the tips!
>>
>> My target, when I got the error, was mingw32. I haven't seen
>> the same error when compiling for linux or osx. (But I don't
>> usually test those versions in a read-only directory either)
>>
>> > 3. By default, GC_log_printf write to stderr.
>>
>> That's strange, since it has generated this file:
>> -rw-rw-r-- 1 kjetil kjetil 120 2012-11-19 18:16 radium.bin.gc.log
>>
>> I cross compile my program using fedora 17, maybe something went
>> wrong when setting the default target for GC_log_printf.
>>
>> I'm pretty sure bdw-gc was compiled like this:
>> mingw32-configure && mingw32-make
>>
>> On 20.11.2012 16:59, Ivan Maidanski wrote:
>> > Hi Kjetil,
>> >
>> > 1. New abort function could be set via GC_set_abort_func.
>> > 2. You haven't specified your target.
>> > 3. By default, GC_log_printf write to stderr.
>> > 4. If you want to permanently ignore GC_log, you could pass
>> > -DGC_LOG_TO_FILE_ALWAYS -DGC_LOG_STD_NAME="/dev/null"
>> > 4. What should GC do in case of error?
>> >
>> > Regards,
>> > Ivan
>> >
>> > Tue 20 Nov 2012 16:25:48 Kjetil Matheussen :
>> >
>> >> Hi,
>> >>
>> >> I just got a crash which I think was caused by running my
>> program
>> >> in a
>> >> read-only directory.
>> >>
>> >> WRITE failed in GC_log_printf, and then ABORT() was called.
>> >>
>> >> Perhaps there is a configuration flag I can set which prevents
>> >> ABORT
>> >> from aborting?
>> >> (didn't find any though). I don't want the garbage collector to
>> >> abort
>> >> the program
>> >> in production code, even if it could be a serious error.
>> >>
>> >> I'll just redefine ABORT for now, but I think the default
>> behavior
>> >> needs to be changed.
>> >> (It could of course also be that I have misunderstood something)
>> >>
>> >> -Kjetil
>> >>
>> >> _______________________________________________
>> >> Gc mailing list
>> >> Gc at linux.hpl.hp.com [1] [1]
>> >> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/ [2] [2]
>> >
>> >
>> >
>> > Links:
>> > ------
>> > [1]
>> > http://www.eposttjener.no/sentmsg?compose
>> [3]&To=Gc at linux.hpl.hp.com
>> > [2] http://www.hpl.hp.com/hosted/linux/mail-archives/gc/ [4]
>
>
>
> Links:
> ------
> [1] 
> http://www.eposttjener.no/sentmsg?compose|+|amp|+|To=Gc@linux.hpl.hp.com
> [2] http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> [3] http://www.eposttjener.no/sentmsg?compose
> [4] http://www.hpl.hp.com/hosted/linux/mail-archives/gc/


More information about the Gc mailing list