2 ms·
> it permits fine control over memory layout and allocation I had thought that Go had a built-in garbage collector that could not be disabled - is that incorre
by NickPollard 16y ago
> it permits fine control over memory layout and allocation
I had thought that Go had a built-in garbage collector that could not be disabled - is that incorrect? Can you build code that only touches memory with explicit malloc/free (or equivalent) calls?
I was very interested in Go when it was announced, but the GC rules it out for my problem domain (high-performance real-time games). If I can do explicit memory management then that makes it interesting again.
- kaib 16y ago> Can you build code that only touches memory with explicit malloc/free (or equivalent) calls? Yes you can. There is a package called 'unsafe' that lets you do pointer arithmetics and turn pointers into valid go types. It requires a bit of finesses, pointers from your own memory obviously wont be counted by the gc etc. Plus you need to make sure you only allocate with your own functions. That said, the gc is getting along, it's hard to say when it hits a spot where you can use it for soft realtime applications. We just started doing high performance server coding in Go at Tinkercad and I used it while I still was at Google.