4 ms·
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, an
by peterevans 9y 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?
- camus2 9y ago> 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.
- innagadadavida 9y agowhile it is not fully manual memory management, you can use sync.Pool and it gives you better performance as you can reduce garbage generation.
- thefounder 9y agoWhat does deterministic behavior has to do with "better performance" ?
- deleted 9y ago[deleted]