4 ms·
C believes that programmer doesn't make mistakes. About memory management, I don't think it should be a language feature because there are some good implemented
by liuliu 18y ago
C believes that programmer doesn't make mistakes. About memory management, I don't think it should be a language feature because there are some good implemented libraries out there.
- alecco 18y agoLike? (No sarcasm.) I tend to see all major projects end up doing things their way: OpenSSL, Apache HTTPd, GCC, Linux, BSD, for example.
- scott_s 18y agoI used to do research with multithreaded memory allocators. The best of class is, I think, TCMalloc, which is a part of Google's perftools: http://code.google.com/p/google-perftools/ http://code.google.com/p/google-perftools/. Hoard is also suitable for use in real applications: http://www.hoard.org/ http://www.hoard.org/ Then there's my work, which is frankly not suitable for using in a real application since it's tested as heavily as the other two I mentioned: http://people.cs.vt.edu/~scschnei/streamflow/ http://people.cs.vt.edu/~scschnei/streamflow/
- alecco 18y agoCool! I didn't know Google did a plain C one (thought those were C++) and yours looks interesting. But my original point was there is no stantard way. It should be part of CXX, libc, or POSIX, IMHO. C is just too atomized.
- scott_s 18y agoThere's a standard interface, but there's no standard implementation - which is how standards generally work. Also, I can't edit my post, but that should say "it's not tested as heavily."
- alecco 18y agoI was thinking more along the lines of automatic memory in my original grandparent post. [yeah, I guessed you meant that from the sentence structure]
- scott_s 18y agoThen C is not what you're looking for. I'm not arguing against garbage collected languages, but for the necessity of non-GC languages to exist.
- alecco 18y agoHmmm, not so fast... This is not cool: In particular, at startup TCMalloc allocates approximately 6 MB of memory.
- scott_s 18y agoDepends on your needs. TCMalloc trades space for speed.