ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Сборщик мусора

Open Andreyproger opened this issue 3 years ago • 3 comments

Сборщик мусора либо помечать участки не используемой памяти, чтобы избежать memory leak.

Andreyproger avatar Feb 10 '22 16:02 Andreyproger

Было уже, с С++11 никто ничего не сделал, есть пропозал на удаление

Minimal support for Garbage Collection was added to C++0x in 2008 by [N2670]. The main addition was the concept of "strict pointer safety", as well as library support for this pointer safety. Most of the rationale leading to the wording in this paper is captured in the two preceding proposals that merged to form this minimal paper, [N2310] and [N2585].

There have been successful garbage collectors for C++, for example the Boehm GC as well as Garbage Collectors in language virtual machines where the VM is implemented in C++, to support a garbage-collected language. This allows the implementation language to reference objects in the garbage collected language, and lets them interface very closely. You’re likely reading this paper in such a virtual machine, implemented in C++, with support for garbage collection: JavaScript VMs do this. Similarly, you’ve probably played games which mix C++ and C# using the Unity game engine, which relies on the Boehm GC.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2186r2.html

crackedmind avatar Feb 10 '22 18:02 crackedmind

Уже удалили поддержку, номинально добавленную в С++98

kelbon avatar Feb 12 '22 15:02 kelbon

Посмотрите на Hazzard Pointer https://wg21.link/p1121

Это "правильный GC" для C++. Или вам нужно нечто другое?

apolukhin avatar Apr 03 '22 08:04 apolukhin