How to understand GC?
GC is understood as garbage collection. A common trigger for garbage collection is a count reference. When the reference count is 0, garbage collection will be triggered. At this time, the system will not recycle memory, but will store it as garbage for quick use when needed next time. Turning off the GC system will completely reclaim memory.
C language and C++have no garbage collection mechanism.
Method 1: Set the environment variable GOGC=off
Method 2: call debug. SetGCPercent (- 1) at runtime