Accurate, pauseless & deterministic GC for C++

Hi all, The HnxGC Library for C++ is released at http://hnxgc.harnixworld.com This garbage collector provides accurate, pause-less (lock-free, block-free) concurrent garbage collection with deterministic reclamation for C++ application. Efficient, portable, no need registeration of root set pointers, no scanning of root set area, and more. Precompiled binary and source are available. Welcome any discussions and comments. -Mingnan Guo --------------------------------- Get easy, one-click access to your favorites. Make Yahoo! your homepage.

Mingnan Guo wrote:
This garbage collector provides accurate, pause-less (lock-free, block-free) concurrent garbage collection with deterministic reclamation for C++ application. Efficient, portable, no need registeration of root set pointers, no scanning of root set area, and more.
I wonder how your GC can implement lock-free concurrency in standard C++ that doesn't even know what a thread is.

Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote: Mingnan Guo wrote:
This garbage collector provides accurate, pause-less (lock-free, block-free) concurrent garbage collection with deterministic reclamation for C++ application. Efficient, portable, no need registeration of root set pointers, no scanning of root set area, and more.
I wonder how your GC can implement lock-free concurrency in standard C++ that doesn't even know what a thread is. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost We provide back-end multi-threading interfaces for various platforms, such as implement through CRITICAL_SECTION on Win32, or through pthread library on Win32/Linux. --------------------------------- Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.

I don't know if I'm the only one, but I am worried about your intentions: The first (and so far only thing I did) was searching for a license of your GC. From your FAQ: "Q: Is HnxGC a freeware? or a GNU open-sourced project? A: No. HnxGC is *NOT* a freeware. The author of HnxGC has filed several patents of HnxGC in the United States and other countries. Whoever without authority makes, uses, offers to sell, or sells any of these patented invention, within the United States and/or other countries infringes the patent(s). However, the source code of HnxGC is available for reference upon request. For a non-commercial educational purpose, you may be granted free to use, copy and distribute the software and its documentations." Do you intend to put your library under the Boost Software License? Or is this just some inappropriate marketing (spam) which has no relevance to Boost? Regards, Daniel

"Daniel Frey" <d.frey@gmx.de> дÈëÏûÏ¢ÐÂÎÅ:1195640722.20820.7.camel@fiasko...
Currently, HnxGC is not under the Boost Software License, but it is possible that in near or later future, we will release a version of HnxGC under Boost Software License. Prior to doing that, I want to be sure that whether or not the Boost License is conflicting with patented/patent-pending technologies. Could any body give me some successful examples of patents under Boost Software License, or explain it? -Mingnan Guo --------------------------------- Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.

"Daniel Frey" <d.frey@gmx.de> дÈëÏûÏ¢ÐÂÎÅ:1195640722.20820.7.camel@fiasko...
Currently, HnxGC is not under the Boost Software License, but it is possible that in near or later future, we will release a version of HnxGC under Boost Software License. Prior to doing that, I want to be sure that whether or not the Boost License is conflicting with patented/patent-pending technologies. Could any body give me some successful examples of patents under Boost Software License, or explain it? -Mingnan Guo --------------------------------- Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.

Mingnan Guo wrote:
The BSL does not say anything about patents. However, it does say that it grants permission for anyone to use the library free of charge, for any purpose. If you know about patents covering the library, and cannot guarantee that a license to these patents is given to every user of the library free of charge (for example, by being the holder of said patents and giving this guarantee in a legally binding way), then you are in no position to grant this license. In fact, simply by releasing the software under the license, in the full knowledge that it uses the patented technology (and you'll convince no one that you didn't know about your own patents), it could be argued that are giving a general license for the patents to everyone. Or even if that is not the case, it could be argued that you acted in bad faith when releasing the library, and any subsequent attempt to demand license fees will fail. So, if you release the software under the BSL (or pretty much any other open-source license, even the simple BSD license), you might as well not patent the technique at all. My opinion. IANAL, though, and my legal knowledge is limited to the laws of Austria, where software patents are technically impossible, anyway. Sebastian Redl

Can any body grant BSL license with some conditions, such as only free for non-commercial use, or free for small-entities (a company with less than 30 employees)? I guess this type of license will be disallowed for its pollution to the BSL, am i right? -Mingnan Guo Sebastian Redl <sebastian.redl@getdesigned.at> wrote: The BSL does not say anything about patents. However, it does say that it grants permission for anyone to use the library free of charge, for any purpose. If you know about patents covering the library, and cannot guarantee that a license to these patents is given to every user of the library free of charge (for example, by being the holder of said patents and giving this guarantee in a legally binding way), then you are in no position to grant this license. In fact, simply by releasing the software under the license, in the full knowledge that it uses the patented technology (and you'll convince no one that you didn't know about your own patents), it could be argued that are giving a general license for the patents to everyone. Or even if that is not the case, it could be argued that you acted in bad faith when releasing the library, and any subsequent attempt to demand license fees will fail. So, if you release the software under the BSL (or pretty much any other open-source license, even the simple BSD license), you might as well not patent the technique at all. My opinion. IANAL, though, and my legal knowledge is limited to the laws of Austria, where software patents are technically impossible, anyway. Sebastian Redl _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost --------------------------------- Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.

On 28/11/2007, Mingnan Guo <hnxgc_pub@yahoo.com> wrote:
Based on the License Background (http://boost.org/more/license_info.html) and Who's Using Boost (http://boost.org/doc/html/who_s_using_boost_/shrink.html), such a license would seem to be against the goals of Boost. I think to have the types of restrictions you wish for, you'll need a much more elaborate license than a BSL-styled one. I think that, since you're allowed to redistribute Boost code quite freely, it's possible that a naïve addition would make it possible for a small entity to repackage boost and have that repackaged library usable without restrictions. Patents are icky; IANAL.

Well, the essence of the BSL is the abscence of such restrictions. If you want to release your code a open source but reserve commercial uses to your own, you may choose the GPL for the open source part so that no other company may incorporate it in its non-GPL product. For those companies that wish to do so, you could release it under some commercial license with a price tag depending on the company size or whatever you like. But that is no Boost software license anymore. I consider the BSL as being fairly extreme... Yours, Martin. -- Dr. Martin Schulz (schulz@synopsys.com) Software Engineer Synopsys GmbH Karl-Hammerschmidt-Str. 34 D-85609 Dornach, Germany Munich office: +49 (89) 993-20203 Home office: +49 (721) 6099511 http://www.synopsys.com

Martin Schulz wrote:
If you want to release your code a open source but reserve commercial uses to your own, you may choose the GPL
The GPL perfectly allows commercial use. It's just that it may not be very interesting to sell it because all people that bought it are free to copy and resell it too. Actually, allowing any use is required for a license to be a free software one.

Mathias Gaunard wrote:
Not so according to http://en.wikipedia.org/wiki/Frank_Easterbrook ("Frank Hoover Easterbrook (born 1948) is Chief Judge of the United States Court of Appeals for the Seventh Circuit. He has been Chief Judge since November 2006, and has been a judge on the court since 1985. Easterbrook is noted for his use of economic analysis of law, his legalist approach to judicial interpretation, for his clear writing style, and for being one of the most prolific judges of his generation. Easterbrook is one of the most prolific and most cited appellate judges in America."): http://www.ca7.uscourts.gov/fdocs/docs.fwx?submit=showbr&shofile=06-2454_008.pdf "Authors who distribute their works under this license, devised by the Free Software Foundation, Inc., authorize not only copying but also the creation of derivative works--and the license prohibits charging for the derivative work. People may make and distribute derivative works if and only if they come under the same license terms as the original work. Thus the GPL propagates from user to user and revision to revision: neither the original author, nor any creator of a revised or improved version, may charge for the software or allow any successor to charge. Copyright law, usually the basis of limiting reproduction in order to collect a fee, ensures that open-source software remains free: any attempt to sell a derivative work will violate the copyright laws, even if the improver has not accepted the GPL. The Free Software Foundation calls the result ``copyleft.''" He he. regards, alexander.

Alexander Terekhov wrote:
That is not in contradition to: "The GPL allows commercial use". If Microsoft distributed Word under the GPL, then I could still use Word at my office (which is what "commercial use" means). I just wouldn't have to pay for it (and couldn't charge others for it). I also think the learned judge is wrong. The original author /may/ charge for the software. The author didn't receive the software under the terms of the GPL, so may do what he likes with it (including charge). Of course, he may not have many purchasers ... (Also note that if the community submits a patch, the original author can't sell anything containing that patch.) Final thought: This is all off topic for the boost mailing list. As I understand it, new boost libraries /must/ be licensed under the BGL; end of story. -- Martin Bonner Senior Software Engineer/Team Leader PI SHURLOK LTD Telephone: +44 1223 441434 / 203894 (direct) Fax: +44 1223 203999 Email: martin.bonner@pi-shurlok.com www.pi-shurlok.com disclaimer

On 29/11/2007, Alexander Terekhov <terekhov@web.de> wrote:
That's a rather interesting quotation, given that the GPL itself contains the following sentence: "You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee." ~ Scott

Scott McMurray wrote:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ http://www4.law.cornell.edu/uscode/17/101.html "Copies are material objects, other than phonorecords, in which a work is fixed by any method now known or later developed, and from which the work can be perceived, reproduced, or otherwise communicated, either directly or with the aid of a machine or device. The term copies includes the material object, other than a phonorecord, in which the work is first fixed." Easterbrook (06-2454_008.pdf): "Red Hat, Inc., sells media (such as DVDs), manuals, and support for the installation and maintenance of Linux. The GPL covers only the software; people are free to charge for the physical media on which it comes and for assistance in making it work. Paper manuals, and the time of knowledgeable people who service and support an installation, thus are the most expensive part of using Linux." :-) regards, alexander.

Alexander Terekhov wrote:
Right, it is easy enough to find people to make your point. And the more popular an opinion is the easier it gets.
Correct.
--and the license prohibits charging for the derivative work.
Not correct, or at best, misleading.
People may make and distribute derivative works if and only if they come under the same license terms as the original work.
Correct again. I'd just like to point out that "to charge for someone's work" is a somewhat ambiguous term. People have certain conceptions of how economy works, and thus, that changes to economic relationships as imposed by the GPL are hard to grasp, as it requires people to adjust their preconceptions. That's always challenging. There are numerous companies that seem to be able to commercialize on Free Software (for example by not charging for the software as a product, but the work on it as a service). Thus, it would be more appropriate to talk about proprietary use, as opposed to commercial use. Sorry for the off-topic post. I won't further engage into this discussion. FWIW, Stefan -- ...ich hab' noch einen Koffer in Berlin...

Stefan Seefeld wrote: [...]
Visit http://www.law.uchicago.edu/faculty/easterbrook and let him know about that. (I gather that according to you, he must be utterly confused by GPLv2 2b. :-) ) regards, alexander. -- "PJ points out that lawyers seem to have difficulty understanding the GPL. My main concern with GPLv3 is that - unlike v2 - non-lawyers can't understand it either." -- Anonymous Groklaw Visitor

----Original Message---- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Mingnan Guo Sent: 29 November 2007 00:36 To: boost@lists.boost.org Subject: Re: [boost] Accurate, pauseless & deterministic GC for C++
Well, if you do, it won't be the BSL - it will be some other license. Such a license /definitely/ would not meet the requirements of boost. Also, what would the point of such a license be? The whole point of the BSL is that it /doesn't/ have such restrictions. -- Martin Bonner Senior Software Engineer/Team Leader PI SHURLOK LTD Telephone: +44 1223 441434 / 203894 (direct) Fax: +44 1223 203999 Email: martin.bonner@pi-shurlok.com www.pi-shurlok.com disclaimer

On Nov 22, 2007 11:39 PM, Mingnan Guo <hnxgc_pub@yahoo.com> wrote:
From the Boost License Requirements: "Must grant permission without fee to copy, use and modify the software for any use (commercial and non-commercial)." I do not think that it necessarily conflicts with patents, as long as you give every user of your program (and of derived work) a royalty free license to use your patents [1], it might be ok, but somehow I doubt this is what you had in mind. Disclaimer: IANAL, ask a lawyer, etc... HTH, [1] which in practice makes the patent useless, with the notable of exception of preventing others to patent the same idea. -- gpd

Giovanni Piero Deretta wrote:
[1] which in practice makes the patent useless, with the notable of exception of preventing others to patent the same idea.
The mere publication of the library does this, by virtue of being prior art. The only advantage is that having a patent makes fighting the other patent that much easier. Sebastian Redl

Only noticed this now... Sebastian Redl wrote:
And to clear up any confusion... One can't patent "ideas". -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

At 10:30 PM +0100 11/23/07, Giovanni Piero Deretta wrote:
AFAIK, until about 1976, this (you can't patent ideas) was true (at least in the US). However, around that time, the patent office suddenly decided that mathematics (the RSA algorithm) was patentable. -- -- Marshall Marshall Clow Idio Software <mailto:marshall@idio.com> It is by caffeine alone I set my mind in motion. It is by the beans of Java that thoughts acquire speed, the hands acquire shaking, the shaking becomes a warning. It is by caffeine alone I set my mind in motion.

On 11/20/07 07:21, Mingnan Guo wrote:
The HnxGC Library for C++ is released at
This sounds interesting. I've looked briefly at: http://hnxgc.harnixworld.com/algo_overview.htm which contains: More specifically, we use reference counting technique to count the number of references from outside of the managed heap. When the count is not zero, it means that the object is marked-out and belongs to root objects of tracing collection. Therefore, by dynamically marking out root objects in application program execution, tracing collector can treat the managed heap boundary as the consideration boundary of tracing garbage collection, it need not to know about the outside of the managed heap and avoids analyzing complicated outside environments, such as program's stack and processors' registers. suggests a similarity to the three-phase cyclic refcounting garbage collectors mentioned on p. 62 of the 1996 edition of: http://www.cs.kent.ac.uk/people/staff/rej/gcbook/gcbook.html The following is from that page: Their general idea is to perform three partial traversals of the data structure, in the first place removing the contribution of pointers internal to the sub-graph being traversed from cell reference counts. At the end of the first traversal, the reference counts will only reflect external pointers to nodes in the sub-graph. The first phase sounds like its similar to the "count the number of references from outside of the managed heap" part of algo_overview.htm. Is that about right? Also, I see on: http://hnxgc.harnixworld.com/algo_rootobj.htm there's: References inside managed heap, such as pointer fields of managed objects, can be easily described by a "traverse" method. and also: Normally, each class should have its own traverse routine defined. However, IIRC, Peter Dimov provided an accurate GC with this same requirement for a traverse routine, called sp_enumerate here: http://www.pdimov.com/cpp/shared_ptr_0x.html#cycles and a similar method, AFAICT, for determining the external pointers to an object. However, after briefly looking at the code: http://www.pdimov.com/cpp/enable_sp_collect.cpp I can't tell where the trial decrements for each external reference is done, which is what both [Chritopher,1984] and [Lins,1992a] methods do, at least according to: In both cases, trial decrements are made to the reference coungs of the descendants of cells encountered. from p. 71 of the aforementioned gcbook; however, I do remember going over that code (or an earlier version of it) where it was doing essentially the same thing to determine the number of external counts. Maybe Peter could clarify. So, the question now is: How is the HnxGC method for precisely collecting cycles better than the enable_sp_collect.cpp method? -regards, Larry

"Larry Evans" <cppljevans@suddenlink.net> дÈëÏûÏ¢ÐÂÎÅ:fhvbf1$cc4$1@ger.gmane.org...
Hi Larry, Thanks for your interest in the HnxGC Library and raise such good question. Actually, there are so many variations of garbage collection algorithm that had forced me to give up the crazy idea many years ago to learn about them all. So, based on the HnxGC algorithm, I am answering your questions as follows: (1)
I did *NOT* suggest such similarity. In HnxGC, the counts reflecting external pointers to an object is directly maintained by CLockedPtr<> smart pointer throughout the execution of application. At any point of time, we maintain a count for every object reflecting the number of reference from root set (external pointers). So, when performing tracing collection, the root objects have already identified. In your quotation of three-phase cyclic refcounting algorithm, the count only reflect external pointers to nodes at the end of the first traversal, which I think it means the counts are calculated when performing tracing collection, as described in Peter Dimov¡¯s paper http://www.pdimov.com/cpp/shared_ptr_0x.html#cycles. The following is from the page: [Note: The reachability analysis may be performed using Christopher's algorithm. Using the instance graph, compute the use counts the objects would have if there were no external shared_ptr instances. Compare the computed use counts with the actual use counts. For every mismatch, mark the object as reachable from the outside. Propagate reachability throughout the graph. --end note] (2)
I agree with you. The enable_sp_collect.cpp seems use another algorithm to determine the root objects that traversal will begin with. I guess, it registers every external pointers by sp_track() function as: int main() { boost::shared_ptr<X> root( new X ); sp_track( root ); ¡ } This design will introduce some costs, especially when function-local variables are frequently accessed. In HnxGC, there is not such registration requirement. (3) From an especial angle of view on various garbage collectors, they can be divided into several types based on how to determine the root objects. Most GCs, such as .NET and official Java JVM, scan the root set area for references, including in threads¡¯ execution stack, static data, CPU¡¯s registers etc. Some others use data structures to collect pointers from root set, the most dedicated and fast design I have seen was patent US 6,907,437. It uses a single-linked list to link all pointers in a thread¡¯s stack. Microsoft also use gc_ptr to register some root pointers as well as a very early version of Sun Java GC use indirect pointer array to avoid scanning root set. Their main pitfalls are the performance cost, especially for multi-threading concurrent collector. HnxGC use reference counting to mark root object and provide deterministic reclamation. The cost is mainly based on atomic RC operation, such as LOCK INC/DEC instruction in the x86 platform. Because the RC operation has already required atomic semantics, HnxGC is easy to implement a concurrent collector without introducing too much lock/synchronization cost. There is no requirement to use locks to protect register/de-register operation of external pointers, which costs very high since external pointer may be frequently created, gain a reference, lost a reference, and/or be destroyed. (4) One major difference between HnxGC and Peter Dimov¡¯s algorithm is: in HnxGC, we use different type of smart pointers in different area, such as CLockedPtr<> in root area (external pointers in pdimov¡¯s words), and CMemberPtr<> in managed heap (internal pointer?), while Peter only uses one type of smart pointer shared_ptr<>. Our approach does introduce some inconveniences but I think it is acceptable. This type of design also helps to significantly reduce RC cost by using ¡°move¡± assignment of CLockedPtr<>. (5) As concerning tracing collection, HnxGC uses a mark & sweep algorithm similar to the Peter¡¯s choice. We needs a Traverse() routine defined by application program like Peter¡¯s sp_enumerate() except we do not require user-class to derives from a base class, e.g. enable_sp_collect, and disallow that collector asynchronously changes pointers of managed objects. HnxGC provides reclamation ordering control to help application to use RAII design pattern.
How is the HnxGC method for precisely collecting cycles better than the enable_sp_collect.cpp method?
In comparison with enable_sp_collect.cpp method, HnxGC has more considerations by design for a multi-threading environment. It provide pause-less concurrent garbage collection (lock-free, no-suspension, no memory ordering for SMP); it removes significant portion of the cost of regular reference counting; it provides reclamation ordering control for RAII design pattern; it provides rich programming features, such as interior pointer, resurrection, etc. BTW: I also paste this message to HnxGC google group, which is public opened and welcome all HnxGC discussions. - Mingnan Guo --------------------------------- Get easy, one-click access to your favorites. Make Yahoo! your homepage.

Mingnan Guo wrote:
Actually, there are so many variations of garbage collection algorithm that had forced me to give up the crazy idea many years ago to learn about them all.
Then I wonder how you came up with the idea of patenting this stuff. Do you hope to obtain the patent(s) even if your ideas are not novel at all and happen to be already used in those other algorithms that you gave up learning? To Boosters: Note that this (the patenting part), unfortunately, is not entirely off topic here... -- Maciej Sobczak * www.msobczak.com * www.inspirel.com

Maciej Sobczak <prog@msobczak.com> wrote: Mingnan Guo wrote:
Actually, there are so many variations of garbage collection algorithm that had forced me to give up the crazy idea many years ago to learn about them all.
Then I wonder how you came up with the idea of patenting this stuff. Do you hope to obtain the patent(s) even if your ideas are not novel at all and happen to be already used in those other algorithms that you gave up learning? To Boosters: Note that this (the patenting part), unfortunately, is not entirely off topic here... -- Maciej Sobczak * www.msobczak.com * www.inspirel.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost I did study but not all of them. Every minutes, there may be a new good idea born in some one's head that prior to yours, nobody can guarantee a patent application has not conflicted with other prior arts. If you found a patent is not novel based on one or more prior art evidences, you can appeal to cancel the patent even after it is issued. - Mingnan Guo --------------------------------- Get easy, one-click access to your favorites. Make Yahoo! your homepage.

On 11/21/07 02:41, Mingnan Guo wrote:
[snip]
So, based on the HnxGC algorithm, I am answering your questions as follows:
I did *NOT* suggest such similarity.
I apologize. I used the wrong word. I should have said "it sounds like it may be similar to the three-phase ...".
Yes. That's also one reason for what I think maybe the slowness, although I hadn't benchmarked it vs. Boehm's collector. Actually I did have, at one time, a benchmark of Lin's method which did show the quadratic behavior mentioned in: http://www.research.ibm.com/people/d/dfb/papers/Bacon01Concurrent.pdf
, as described in Peter Dimov's paper
I think there's also the memory cost of the two maps. I think one of the maps is a map from refcounted-object to external refs, but that conclusion is based on my long-ago analysis of the code. I've forgotten what the other map is for. [snip]
Ah! That's the key. So, the programmer has to assure that each CLockedPtr<>'s address is in the root area? If so, then what happens if the programmar violates this restriction? Does the CLockedPtr CTOR test it's "this" pointer to assure it's *not* in the managed heap? I assume the CLockedPtr CTOR and operator=, when accessing a managed pointer, increments the external pointer count of the managed object. Of course, this raises the question of whether this is more error prone than just using weak pointers to break the cycles. Then, you'd have strong_ptr's and weak_ptr's vs. CLockedPtr's and CMemberPtr's. OTOH, if my assumption about CLockedPtr CTOR knowing where it's located (in root area or not), then CMemberPtr could do same, and then there wouldn't be any need for two different smart-ptrs. What am I missing?
Does Peter's collector asynchronously change pointers of managed object? Maybe he does that to break a cycle and then use delete on a pointer to reclaim memory, but I don't see that as a problem.
HnxGC provides reclamation ordering control to help application to use RAII design pattern.
How is the HnxGC method for precisely collecting cycles better
OK, I guess this is needed in case of cycles, and I guess this is used to break a cycle before HnxGC uses delete on a pointer to reclaim memory, just as described above, only the ordering control is used to determine where to break the cycle. However, this raises again the question of why not use weak_ptr's instead. These, in effect, provide reclamation ordering control, AFAICT. than
the enable_sp_collect.cpp method?
I'm know very little about threading, but this stuff about RAII sounds good. I'm wondering if you could provide both multi-threading and single-threading versions so that those not needing multi-threading wouldn't have to pay for the synchronization costs. -regards, Larry

"Larry Evans" <cppljevans@suddenlink.net> дÈëÏûÏ¢ÐÂÎÅ:fi1h0s$s2r$1@ger.gmane.org...
Yes, application program should guarantee that, (1) CLockedPtr<> smart pointers reside in root set area, they can point to somewhere in managed memory pool. In another word, you should not put the CLockedPtr<> as member variables of a managed object/class; (2) CMemberPtr<> should only be used as member variables of a managed object/class. Note 1: But, in fact, the HnxGC API does not require above restriction. Sometime, you can violate them to achieve special effect/goal, in case you know what you are doing. These smart pointers is a high-level layer based on HnxGC API to ease programming.) . Note2: CWeakPtr<> can be used in managed memory pool or root set area. It is a pure programming sugar. The reference counting & tracing collector does not depend on them. We don't need to break cycles prior to collect them.
I don't know whether Peter's collector asynchronously change user objects or not. I just want to say HnxGC users are guaranteed that HnxGC will not touch user objects and no way to do that. HnxGC collector does not know the address of member pointers of an object.
Reclamation ordering is an option. Application programmer can declare one or more dependence requirements for their destructors, but they are not required to do so. By default, circular referenced garbage are collected out-of-order (can be any order). In most case, application program need not declare a dependence requirement. The collector does not depend on them to break cycles. It collects cycles directly without need to break them in advance.
Yes, actually three types of HnxGC library are provided, Single-threading(ST), Multi-threading for Uniprocessor (MT/UP) and Multi-threading for Multiple-processors (MT/MP). Single-threading perform tracing collection in the only one thread, similar to sp_collect() in http://www.pdimov.com/cpp/enable_sp_collect.cpp. The thread cannot do any other things during the collection. The other two multi-threading versions can perform pause-less concurrent collection, while MP(multiple-processors) version removes some memory ordering requirement in some platform, such as IA64. You can consider using MT version even in a single thread application, the cost is not so much as people thought. With maximum optimization of modern C++ compiler, the cost is mainly based on atomic reference counting. The synchronization cost does not occur when there is not a concurrent tracing collection running. regards -Mingnan Guo [welcome join the HnxGC google group http://groups.google.ca/group/HnxGC?hl=en, and get the latest info about HnxGC.] --------------------------------- Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
participants (15)
-
Alexander Terekhov
-
Daniel Frey
-
Giovanni Piero Deretta
-
John Maddock
-
Larry Evans
-
Maciej Sobczak
-
Marshall Clow
-
Martin Bonner
-
Martin Schulz
-
Mathias Gaunard
-
Mingnan Guo
-
Rene Rivera
-
Scott McMurray
-
Sebastian Redl
-
Stefan Seefeld