3 ms·
yes, Java/C# GCs (Android included) and Go GC are very different beasts. Go GC does not move objects in memory (mark and sweep) while other GCs (mark and compa
by _old_dude_ 4y ago
yes, Java/C# GCs (Android included) and Go GC are very different beasts.
Go GC does not move objects in memory (mark and sweep) while other GCs (mark and compact) do, to avoid heap fragmentation and better throughput (see generational GCs).
One issue with mark and compact GCs is that you can not move the array of bytes during a system call. A ByteBuffer/Memory object, is an object that allocates its byte arrays using malloc, outside of the heap, so the bytes are not moved by the GC.