Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
pebal
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
10 ms
·
61.
▲
by
pebal
3y ago
There is only one like that, SGCL for C++ https://github.com/pebal/sgcl
62.
▲
by
pebal
3y ago
It will never be called gc_ptr because C++ programmers have an allergy to the term GC. However, an attempt was made to implement a similar solution. Take a look at tracked_ptr: https://github.com/pebal/sgcl
63.
▲
by
pebal
3y ago
You can have completely pauseless GC. Take a look at SGCL for C++.
64.
▲
by
pebal
3y ago
The Mark and Sweep algorithm with tri-color marking variation was used. There is no documentation yet, but I am happy to answer your questions (snibisz@gmail.com).
65.
▲
by
pebal
3y ago
Look at this real-time garbage collector for C++: https://github.com/pebal/sgcl
66.
▲
by
pebal
4y ago
You may have absolutely zero pauses if you don't have heap compaction.
67.
▲
by
pebal
4y ago
You may be surprised. Herb Sutter wants to add optional GC to C++ 'syntax 2'.
68.
▲
by
pebal
4y ago
C++ does not have garbage collection in the standard library, just as shared_ptr was not part of the standard library in the past. You can currently have optional garbage collection in C++: https://github.com/pebal/sgcl
69.
▲
by
pebal
4y ago
Only compacting GCs need to pause application. It is possible to implement GC without pauses.
70.
▲
by
pebal
4y ago
SGCL is a real-time garbage collector for C++ without any pauses. https://github.com/pebal/sgcl
71.
▲
by
pebal
4y ago
You are absolutely right. GC can be an advantage and there is no need to be ashamed of it. Herb Sutter is working on "syntax 2" for the C++ language and wants to have GC smart pointers in C++. The D creators should work on improvi
72.
▲
by
pebal
4y ago
Show an example of a lock-free concurrent stack freeing nodes memory.
73.
▲
by
pebal
4y ago
A similar example is posted there, just read it. It's best to read about the problems of concurrent containers, because you clearly don't understand the topic.
74.
▲
by
pebal
4y ago
From the document you linked: int lfstack_pop(_Atomic lfstack_t \*lfstack) { lfstack_t next; lfstack_t orig = atomic_load(lfstack); do { if (orig.head == NULL) // undefined behavior !!!
75.
▲
by
pebal
4y ago
In the link I pointed you have an example given and an explanation of why you need to have specific memory management for concurrent containers. It cannot be explained any clearer.
76.
▲
by
pebal
4y ago
You need to implement some form of GC when you want to free memory in a lock-free container. Read the thread and the employee's statements from Intel: https://community.intel.com/t5/Intel-oneAPI-Threading-Buildi...
77.
▲
by
pebal
4y ago
Described algorithms ignore the ABA problem. The boost implementation avoids the ABA problem, but does not free up memory at all and stores pointers on 48 bits which is not enough on new architectures.
78.
▲
by
pebal
4y ago
Show an implementation of a concurrent lock-free stack without delayed freeing.
79.
▲
by
pebal
4y ago
I am writing about shared_ptr because C++ is one of a top language. Read about the ABA problem.
80.
▲
by
pebal
4y ago
I see you just don't want to see the problem. Look at this document: https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2014/n41...
81.
▲
by
pebal
4y ago
Did you know that the counter is stored in a different place than the pointer? All current atomic<shared_ptr> implementations use a lock. Stack overflow is not unique to a shared_ptr, but GC pointers don't have this problem. The
82.
▲
by
pebal
4y ago
Can't atomically assign a pointer and increment a counter, need to use a lock. If make a long list using shared_ptr will overflow the stack when the head destructor executes.
83.
▲
by
pebal
4y ago
Reference counting has limitations. It does not release cyclic structures, not suitable for lock-free algorithms and may overflow the stack.
84.
▲
by
pebal
4y ago
You can look at this one: https://github.com/pebal/sgcl
85.
▲
by
pebal
4y ago
There are pauseless real-time GCs: https://github.com/pebal/sgcl
86.
▲
by
pebal
4y ago
SGCL never stops the threads.
87.
▲
by
pebal
4y ago
You can watch Herb Sutter talk about deferred_ptr: https://youtu.be/JfmTagWcqoE
88.
▲
by
pebal
4y ago
Mutators are threads that allocate memory and manipulate pointers, they can work completely independently of the GC. A mutator needs only to tag an object when copies or moves a pointer to this object. The GC detects this tag and marks the
89.
▲
by
pebal
4y ago
By analyzing mutators activity. Only the compacting GCs have to stop the world.
90.
▲
by
pebal
4y ago
You can have GC engine without stopping the world. Completely pauseless.
More ›