Rex Dieter | 2 May 23:44 2010

GC_set_free_space_divisor api change on purpose?

I'm pretty sure the answer is yes, but asking to make sure.

In gc <= 7.1, gc.h contained:

GC_API GC_word GC_set_free_space_divisor(GC_word value);

and in 7.2-alpha4 anyway, now has

GC_API void GC_CALL GC_set_free_space_divisor(GC_word);
GC_API GC_word GC_CALL GC_get_free_space_divisor(void);

Was this api change (at least to GC_set_free_space_divisor's return value) 
intentional?

I'm asking because of downstream bug,
https://bugzilla.redhat.com/show_bug.cgi?id=587391

where this change causes kaya build failures.  If this was intentional, 
should be fairly straight-forward to patch kaya for the new gc behavior.

-- Rex
Ivan Maidanski | 3 May 13:28 2010
Picon

Re: GC_set_free_space_divisor api change on purpose?


Sun, 02 May 2010 16:44:14 -0500 Rex Dieter <rdieter@...>:

> I'm pretty sure the answer is yes, but asking to make sure.
> 
> In gc <= 7.1, gc.h contained:
> 
> GC_API GC_word GC_set_free_space_divisor(GC_word value);
> 
> and in 7.2-alpha4 anyway, now has
> 
> GC_API void GC_CALL GC_set_free_space_divisor(GC_word);
> GC_API GC_word GC_CALL GC_get_free_space_divisor(void);
> 
> Was this api change (at least to GC_set_free_space_divisor's return value) 
> intentional?

Yes, see http://article.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2481/
(Hopefully, there's no too many apps exploiting GC_set_free_space_divisor() returned value.)

> 
> I'm asking because of downstream bug,
> https://bugzilla.redhat.com/show_bug.cgi?id=587391
> 
> where this change causes kaya build failures.  If this was intentional, 
> should be fairly straight-forward to patch kaya for the new gc behavior.

GC_VERSION_MAJOR/MINOR could be tested to select the proper usage model.

> 
(Continue reading)

Rex Dieter | 3 May 18:44 2010

Re: GC_set_free_space_divisor api change on purpose?

Ivan Maidanski wrote:
...
>> Was this api change (at least to GC_set_free_space_divisor's return
>> value) intentional?
> 
> Yes, see
> http://article.gmane.org/gmane.comp.programming.garbage-
collection.boehmgc/2481/
> (Hopefully, there's no too many apps exploiting
> GC_set_free_space_divisor() returned value.)

>> I'm asking because of downstream bug,
>> https://bugzilla.redhat.com/show_bug.cgi?id=587391
>> 
>> where this change causes kaya build failures.  If this was intentional,
>> should be fairly straight-forward to patch kaya for the new gc behavior.
> 
> GC_VERSION_MAJOR/MINOR could be tested to select the proper usage model.

Thanks, will do.

-- Rex
Shi Jie Gung | 5 May 04:11 2010
Picon

Occasionally crash with GraphicsMagick, ImageMagick.

I set GC to GraphicsMagick/ImageMagick's default memory allocator.
Like this:

#include <stdlib.h>
#include <magick/api.h>
#include <string.h>
#include <unistd.h>
#define GC_DEBUG
#ifdef GC_DEBUG
#include <gc/gc.h>
#include <gc/gc_allocator.h>
#undef malloc
#undef calloc
#undef free
#undef realloc
#define malloc(n) GC_MALLOC(n)
#define calloc(m,n) GC_MALLOC((m)*(n))
#define free(p) GC_FREE(p)
#define realloc(p,n) GC_REALLOC((p),(n))
#define CHECK_LEAKS() GC_gcollect()
#endif

int main(int argc, char** argv) {
    #ifdef GC_DEBUG
    GC_init();

    /*GM*/
    /*MagickAllocFunctions(GC_free,GC_malloc,GC_realloc);*/

    /*IM*/
(Continue reading)

Yasir Majeed | 5 May 07:14 2010
Picon

How do i find/generate gc.dll

Hello!

I have compiled a Microsoft Visual C project using gc library. Now when i try to run the exe it says, unable to find gc.dll. how do i find or generate gc.dll. Please guide me

Regards
--
Yasir Majeed
Ph.D scholar
Center of Research in Networks and Telecommunication (CoReNeT)
www.corenet.org.pk
Mohammad Ali Jinnah University Islamabad, Pakistan
+923335935382

_______________________________________________
Gc mailing list
Gc@...
http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
Ivan Maidanski | 5 May 07:51 2010
Picon

Re: Occasionally crash with GraphicsMagick, ImageMagick.


Wed, 5 May 2010 02:11:30 +0000 (GMT) Shi Jie Gung <ksc91u_fr@...>:

> I set GC to GraphicsMagick/ImageMagick's default memory allocator.
> Like this:
> 
> #include <stdlib.h>
> #include <magick/api.h>
> #include <string.h>
> #include <unistd.h>
> #define GC_DEBUG
> #ifdef GC_DEBUG
> #include <gc/gc.h>
> #include <gc/gc_allocator.h>
> #undef malloc
> #undef calloc
> #undef free
> #undef realloc
> #define malloc(n) GC_MALLOC(n)
> #define calloc(m,n) GC_MALLOC((m)*(n))
> #define free(p) GC_FREE(p)
> #define realloc(p,n) GC_REALLOC((p),(n))
> #define CHECK_LEAKS() GC_gcollect()
> #endif
> 
> int main(int argc, char** argv) {
>     #ifdef GC_DEBUG

Call GC_set_find_leak(1) here

>     GC_init();
>     
>     /*GM*/
>     /*MagickAllocFunctions(GC_free,GC_malloc,GC_realloc);*/

It would be good to use GC_debug_free (and friends) here and below. (It's probably not a problem to mix debug
and non-debug version but...)

> 
>     /*IM*/
>     SetMagickMemoryMethods(\
> (AcquireMemoryHandler)GC_malloc,\
> (ResizeMemoryHandler)GC_realloc,\
> (DestroyMemoryHandler)GC_free);
> 
>     #endif
>     InitializeMagick(NULL);
>     ImageInfo *info=(ImageInfo *)malloc(sizeof(ImageInfo));
>     ExceptionInfo * excp=(ExceptionInfo*)malloc(sizeof(ExceptionInfo));
> 
>     GetImageInfo(info);
>     GetExceptionInfo(excp);
>     strcpy(info->filename,argv[1]);
>     Image * tmp = ReadImage(info,excp);
>     Image * ii=ResizeImage(tmp,100,100,BesselFilter,0.9f,excp);
> 
>     DestroyMagick();
>     #ifdef GC_DEBUG
>     CHECK_LEAKS();
>     #endif
>     return (EXIT_SUCCESS);
> }
> 
> With ImageMagick, always crash with backtrace:
> 
> #0  0x00000001001ab74a in GC_free ()
> #1  0x00000001000be22f in RelinquishMagickMemory ()
> #2  0x00000001000a2eed in DestroyLinkedList ()
> #3  0x000000010003c636 in GetConfigureOptions ()
> #4  0x00000001000d4de0 in GetPolicyInfo ()
> #5  0x00000001000d50eb in GetPolicyValue ()
> #6  0x000000010010a49c in ResourceComponentGenesis ()
> #7  0x00000001000bcc35 in MagickCoreGenesis ()
> 
> and with GraphicsMagick, "occasionally" crash with backtrace:
> #0  0x00007fff8441d886 in __kill ()
> #1  0x00007fff844bdeae in abort ()
> #2  0x0000000100268d55 in GC_abort ()
> #3  0x000000010025ed43 in GC_freehblk ()
> #4  0x0000000100264824 in GC_free ()
> #5  0x000000010008f57a in DestroyCacheNexus ()
> #6  0x000000010008f5cb in CloseCacheView ()
> #7  0x000000010008f684 in DestroyThreadViewSet ()
> #8  0x000000010007db8a in DestroyImage ()
> #9  0x00000001000aba5f in ResizeImage ()
> #10 0x0000000100000eb1 in main (argc=2, argv=0x7fff5fbff240) at main.cpp:50
> 
> and sometimes with
> #0  0x000000010025e579 in GC_allochblk_nth ()
> #1  0x000000010025e9e5 in GC_allochblk ()
> #2  0x000000010026498e in GC_alloc_large ()
> #3  0x0000000100264d8f in GC_generic_malloc ()
> #4  0x0000000100264f23 in GC_core_malloc ()
> #5  0x0000000100265c2d in GC_realloc ()
> #6  0x00000001000858f5 in MagickRealloc ()
> #7  0x0000000100090779 in SetNexus ()
> #8  0x0000000100091408 in AcquireCacheNexus ()
> #9  0x0000000100091d1b in AcquireCacheViewPixels ()
> #10 0x00000001000ada9c in HorizontalFilter.omp_fn.1 ()
> #11 0x00000001000ab608 in HorizontalFilter ()
> #12 0x00000001000abb78 in ResizeImage ()
> #13 0x0000000100000eb1 in main (argc=2, argv=0x7fff5fbff240) at main.cpp:50
> 
> with boehmgc-devel  <at> 7.2alpha2 macport 

It's better to use gc72alpha4.

> ImageMagick  <at> 6.6.1-5, GraphicsMagick  <at> 1.3.12r1
> Mac OS X 10.6.3 gcc-mp-4.5 
> 
> Could you help to debug this, thanks.
Ivan Maidanski | 5 May 07:59 2010
Picon

Re: How do i find/generate gc.dll


Wed, 5 May 2010 10:14:14 +0500 Yasir Majeed <leoyasir@...>:

> Hello!
> 
> I have compiled a Microsoft Visual C project using gc library. Now when i try to run the exe it says, unable to
find gc.dll. how do i find or generate gc.dll. Please guide me

E.g. call this from the command line:

cl -MT -DALL_INTERIOR_POINTERS -DGC_THREADS -I.\include -I.\libatomic_ops\src
-D_CRT_SECURE_NO_DEPRECATE -DGC_DLL -LD extra\gc.c gc_cpp.cpp /link /implib:gcdll.lib
/out:gc.dll user32.lib

> 
> Regards
> -- 
> Yasir Majeed
> Ph.D scholar
> Center of Research in Networks and Telecommunication (CoReNeT)
> www.corenet.org.pk
> Mohammad Ali Jinnah University Islamabad, Pakistan
> +923335935382
Ivan Maidanski | 5 May 08:39 2010
Picon

Minor comments update in gc.h

Hi!

I've refined the comments for GC_find_leak, GC_finalize_on_demand, GC_java_finalization,
GC_dont_expand, GC_no_dls, GC_dont_precollect. All these vars are boolean so no real need to worry
about data races (not to mention, they are typically set at a program start-up).
Shi Jie Gung | 5 May 11:42 2010
Picon

Re: Occasionally crash with GraphicsMagick, ImageMagick.

If build gc with --enable-gc-debug

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x000000010025e0c3 in GC_remove_from_fl ()
(gdb) bt
#0  0x000000010025e0c3 in GC_remove_from_fl ()
#1  0x000000010025ef07 in GC_freehblk ()
#2  0x0000000100267523 in GC_free ()
#3  0x00000001002627f4 in GC_debug_free ()
#4  0x000000010008f57a in DestroyCacheNexus ()
#5  0x000000010008f5cb in CloseCacheView ()
#6  0x000000010008f684 in DestroyThreadViewSet ()
#7  0x000000010007db8a in DestroyImage ()
#8  0x00000001000aba5f in ResizeImage ()
#9  0x0000000100000eb3 in main (argc=2, argv=0x7fff5fbff240) at main.cpp:77

though this happen not so often... less than 10 crash in 200 runs.

and I try to link libgc.a instead of libgc.dylib and it crash 2-3 times in 200 runs.

What is the different link with static library and dynamic library?
Shi Jie Gung | 5 May 11:29 2010
Picon

Re: Occasionally crash with GraphicsMagick, ImageMagick.


----- Original Message ----
> From: Ivan Maidanski <ivmai@...>
> To: Shi Jie Gung <ksc91u_fr@...>
> Cc: gc@...
> Sent: Wed, May 5, 2010 1:51:42 PM
> Subject: Re: [Gc] Occasionally crash with GraphicsMagick, ImageMagick.
> 
> 
Wed, 5 May 2010 02:11:30 +0000 (GMT) Shi Jie Gung <
> ymailto="mailto:ksc91u_fr@..." 
> href="mailto:ksc91u_fr@...">ksc91u_fr@...>:

Hello, now I build with gc from cvs.
#define GC_DEBUG 

> 
> int main(int argc, char** argv) 
> {
>     #ifdef GC_DEBUG

> Call GC_set_find_leak(1) 
> here

>     GC_init();
>    
>  
>    /*GM*/
>    
> /*MagickAllocFunctions(GC_free,GC_malloc,GC_realloc);*/
and use these functions
MagickAllocFunctions(GC_debug_free,\
            GC_debug_malloc_replacement,\
            GC_debug_realloc_replacement);
> It would be good 
> to use GC_debug_free (and friends) here and below. (It's probably not a problem 
> to mix debug and non-debug version but...)

crash like this.

GC_debug_realloc: found smashed location at 0x100b9f1c8 in or near object at 0x100b9b020(unknown:0, sz=16800)
GC_debug_free: found smashed location at 0x100b9f1c8 in or near object at 0x100b9b020(unknown:0, sz=16800)
Attempt to free invalid pointer 0x100b9b020
free(invalid pointer)

Program received signal SIGABRT, Aborted.
0x00007fff8441d886 in __kill ()
(gdb) bt
#0  0x00007fff8441d886 in __kill ()
#1  0x00007fff844bdeae in abort ()
#2  0x000000010026d5f0 in GC_abort ()
#3  0x0000000100262c7e in GC_debug_free ()
#4  0x000000010008f57a in DestroyCacheNexus ()
#5  0x000000010008f5cb in CloseCacheView ()
#6  0x000000010008f684 in DestroyThreadViewSet ()
#7  0x000000010007db8a in DestroyImage ()
#8  0x00000001000aba5f in ResizeImage ()
#9  0x0000000100000eb3 in main (argc=2, argv=0x7fff5fbff240) at main.cpp:77
Thanks for your help.

Gmane