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 <[email protected]> http://www.jemarch.net GNU Project http://www.gnu.org
