开发者

Why manual memory management?

Are there any plans for auto memory management?

What are the advantanges of manually managing memory...does it conserve memory in the long run?

I have noticed in .Net Windows Applications - they are very sluggish -开发者_StackOverflow中文版 is this partly due to the garbage collector not working correctly?


Are there any plans for auto memory management?

On Mac — There's garbage collection already on 10.5.

On iPhone — No (as of 4.0).

What are the advantanges of manually managing memory... does it conserve memory in the long run?

See When NOT to use garbage collection?


The advantages of manual memory management are mainly that you can specialize the memory management specifically for your application, making it optimal and allowing "easy" optimization (on size and speed).

Automatic memory management is helpful when it's not necessary and even C++ commitee aknowledge that (there are plans to add an optional garbage collector to C++) but sometimes you really need to control what's happening behind the scene because you have a bigger sight of view of the application than any compiler or garbage collector.

Having choice between both is certainly very powerfull but it's not available in most languages.


With respect to real-time systems, garbage collection can have negative effects on the responsiveness of the program. In their book Small Memory Software, Weir and Noble discuss some of these issues and you can read about it at the end of this section of their book. In many cases programmers simply choose write their own memory management routines that address these issues.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜