Hacker News new | ask | show | jobs
by peterevans 3049 days ago
Like I said: Go does everything C does, but better.

I suppose you could write your own malloc in Go... if you preallocated a bunch of bytes in a huge chunk, and wrote some functions to use that up. But that sounds like a pain.

If you really really specifically need to manage your own memory, then I agree, you shouldn't use Go. But that doesn't mean that Go is not a valid replacement for C. Do you think a majority of programs that are written in C are done so because they need to manage their own memory?

1 comments

> Like I said: Go does everything C does, but better.

It doesn't do everything C does, it doesn't allow manual memory management at first place.

So you can't pretend that a garbage collected language does everything a language with manual memory management does.

Manual memory management is a feature, Go does not have such a feature. Deterministic behavior in a program is fundamental when writing hardware drivers or real time programming, Go can't do that.

while it is not fully manual memory management, you can use sync.Pool and it gives you better performance as you can reduce garbage generation.
What does deterministic behavior has to do with "better performance" ?