[Gc] Question: Can finalizers be used together with typed memory allocation?

Alexander Doronin alexanderdoronin at pdc.spb.su
Thu Sep 19 21:58:01 PDT 2013


Hi Ivan.

OK, thank you very much for the quick answer.

Regards, Alexander


2013/9/20 Ivan Maidanski <ivmai at mail.ru>

> Hi Alexander,
>
> Please do not define GC_DEBUG
> - it is not supported for typed malloc for now (as stated in the header
> file). Non-debugging variant of register finalizer should be usable for
> typed allocations.
>
> Regards,
> Ivan
>
>
> Thursday, 19 Sept 2013, 17:03 +04:00 from Alexander Doronin <
> alexanderdoronin at pdc.spb.su>:
> >
> > Dear Mr. Boehm!
> >
> > We are using your Garbage Collector for Visual Prolog under Windows for
> many years.
> > Now we are going to use the typed memory allocation with finalizers, but
> we have some doubts about it.
> >
> > We have tried to allocate typed memory by function
> GC_malloc_explicitly_typed and register our finalizer by
> GC_REGISTER_FINALIZER_NO_ORDER, but then we are recieving this error here:
> >
> > GC_API void GC_CALL GC_debug_register_finalizer_no_order
> >                                     (void * obj, GC_finalization_proc fn,
> >                                      void * cd, GC_finalization_proc
> *ofn,
> >                                      void * *ocd)
> > {
> >     GC_finalization_proc my_old_fn = OFN_UNSET;
> >     void * my_old_cd;
> >     ptr_t base = GC_base(obj);
> >     if (0 == base) {
> >         /* We won't collect it, hence finalizer wouldn't be run. */
> >         if (ocd) *ocd = 0;
> >         if (ofn) *ofn = 0;
> >         return;
> >     }
> >     if ((ptr_t)obj - base != sizeof(oh)) {
> >         GC_err_printf(
> >           "GC_debug_register_finalizer_no_order called with "
> >           "non-base-pointer %p\n",
> >           obj);
> >     }
> >     ...
> >
> > Could you, please, tell us whether it's possible to use typed allocation
> with finalizers or not?
> >
> > Kind regards, Alexander Doronin
> > _______________________________________________
> > Gc mailing list
> > Gc at linux.hpl.hp.com
> > https://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>



-- 

Regards, Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://napali.hpl.hp.com/pipermail/gc/attachments/20130920/0895a518/attachment.htm


More information about the Gc mailing list