pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Object Layer comments


From: jemarch
Subject: Re: [pdf-devel] Object Layer comments
Date: Wed, 10 Feb 2010 00:10:08 +0100
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.1.91 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

   I don't quite understand the need of the Garbage Collector in the
   object layer, when we already have the possibility of reference
   counting in each PDF object. Why not just start refcount=1 when
   object is created and fully dispose the object when its refcount
   arrives zero?  When adding an object into another one, we add a new
   reference of the object. Then, when unrefing the parent object, we
   would unref each subobject, and such. At the end, all references
   should get balanced, as done usually with GObjects in GTK+.

   Also, can't get the difference between `pdf_obj_destroy()' and
   `pdf_obj_release()'. Isn't it true that an object will only get disposed
   when its refcount arrives zero? If not, what for is the reference
   counting in the PDF object?

Acquire counters are used to avoid the garbage collector to dispose
indirect objects even if they are not reachable from the root object
of the document (the catalog dictionary).  By using acquire counters
the client can assure the existence of an object between full saves of
the document even if that object is not reachable:

 ACQUIRE(OBJ);
 SAVE_DOCUMENT_FULL();  /* With GC. */
 ...

If the user calls pdf_obj_destroy(OBJ) the object is destroyed even if
its acquire counter is bigger than zero.

I will commit the architectural description of the object layer in the
following days.  It contains a detailed description on how
direct/indirect scalar/non-scalar objects are internally managed.
That will clarify those issues, I hope.

   And apart of the reference counting stuff, I believe there are some
   errors in the API.

Those are typos.  Feel free to fix them.

-- 
Jose E. Marchesi  <address@hidden>
                  http://www.jemarch.net
GNU Project       http://www.gnu.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]