RE: How turn-off C-run time library memory diagnostics?
RE: How turn-off C-run time library memory diagnostics?
- Subject: RE: How turn-off C-run time library memory diagnostics?
- From: Erik Buck <email@hidden>
- Date: Fri, 5 Aug 2005 11:33:58 -0400
malloc() and free() do not have particularly "fast" performance on
any non-real-time Unix variant. If you think malloc() and free() are
hard to use in high performance code, try automatic garbage
collection sometime :(
The solution that real-time software developers have used for the
last 25 years at least is to not dynamically allocate memory.
Standard alternatives include a one time large malloc() or vmalloc()
or mmap() in the beginning and using/reusing that buffer over and
over. Free or munmap() the buffer outside "fast" code or just before
application exit or never.
I assume you are using Cocoa. There is an example in "Cocoa
Programming" that reuses the same memory buffer for multiple
instances of NSString. You don't even have to buy the book (although
an inexpensive digital version is available). You can just download
the examples from www.cocoaprogramming.net. If you have the book,
see Section "Avoiding Dynamic Memory Allocation" in Appendix B
"Optimizing and Finding Memory Leaks."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden