Dear WebKit,
Herb Sutter's CppCon 2016 talk "Leak-Freedom in C++... By Default" and
his gcpp experiment named the problem precisely: ownership by unique_ptr
and shared_ptr is deterministic, but cycles still leak, and collecting
them has meant giving up determinism. I would like to show a different
trade-off we have been building for legacy [and non-legacy] code.
The Fornux C++ Superset is a source-to-source compiler built on Clang.
It rewrites existing C++ so that raw pointers become root pointers:
every allocation belongs to the scope that created it, and when that
scope ends, whatever is no longer reachable from outside is destroyed
immediately, cycles included. Destructors run at the same points, in the
same order, on every run. There is no collector, no pause, and no
background thread.
In a minimal test, a program that creates a million two-node cycles and
never deletes them grows by 63,824 kB under plain clang++, and by 0 kB
once compiled through the Superset - with no change to its source. The
same rewrite turns out-of-bounds and null accesses into well-defined
default values instead of undefined behavior.
Single-threaded, creating and dropping an object costs about what
std::shared_ptr costs (9.4 ns vs. 9.3 ns in our benchmark). We are
validating the approach on WebKit's WTF and JavaScriptCore sources. The
method is covered by US patent 11288049B2.
I think the handling of cyclic memory blocks is an overlooked
mission-critical issue.
* The actual core header is available here:
https://github.com/philippeb8/root_ptr/blob/master/include/boost/smart_ptr/root_ptr.hpp
* A more detailed benchmark is available here:
https://github.com/philippeb8/root_ptr/blob/master/bench/ALLOCATOR_BENCHMARK.md
https://github.com/philippeb8/root_ptr/blob/master/bench/ALLOCATOR_BENCHMARK.pdf
* The latest Debian packages including documentation are available
here, but requires a generic Open Source or commercial license to
execute:
https://static.fornux.com/files/exe/fcxxss-headers_6.4-6_all.deb
https://static.fornux.com/files/exe/fcxxss_6.4-6_amd64.deb
You're welcome to take a look and let us know what you think.
Best regards,
--
Email Signature
Fornux Logo <https://www.fornux.com/>
*Phil Bouchard* LinkedIn Icon
<https://www.linkedin.com/in/phil-bouchard-5723a910/>
Founder & CEO
T: (819) 328-4743
E: [email protected]| www.fornux.com <http://www.fornux.com>
3909 S Maryland Pkwy Ste 314, #638, Las Vegas, NV 89119
/NVIDIA Inception Program Member/ <https://static.fornux.com/c-superset/>
Le message ci-dessus, ainsi que les documents l'accompagnant, sont
destinés uniquement aux personnes identifiées et peuvent contenir des
informations privilégiées, confidentielles ou ne pouvant être
divulguées. Si vous avez reçu ce message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named
recipients only and may contain privileged or confidential information
which is not to be disclosed. If you received this communication by
mistake please destroy all copies.
_______________________________________________
webkit-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]