Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What memory management algorithms are used by the major compiler vendors?

This is a subset of a previous question.

As an exercise I am writing a memory manager - that is, the code which implements malloc, realloc and free (or new and delete.) The RTL for my language, Delphi, allows the RTL's memory manager to be replaced easily. For those of you using C++, this is similar to, but lower-level than, overriding new and delete (it hooks into the RTL itself rather than being a language feature.)

I'm looking for resources about high-quality approaches others have taken to the same problem and am trying to find out what algorithms other major compiler vendors use. While Delphi's is well documented, I cannot find any information about the implementations used by MS VC++, .Net, or Objective C. These vendors do not seem (?) to allow their RTL to be hooked into like Delphi does. All documentation seems to be higher-level, such as NSAutoReleasePool to pick a random example - far too high-level for this question.

What memory management algorithms do major vendors (Microsoft VC++ and .Net, and Apple Objective C) use in their runtime libraries?

  • Embarcadero Delphi and C++ Builder is well documented.
  • Linux seems to use Buddy, although I suspect this information is out of date.
  • MS VC++: unknown.
  • .Net: unknown.
  • Objective C: unknown.

An example of a great answer would be a document describing the memory manager implementation, such as this one, or a link to a published paper. An example of a useful answer would be the algorithm, 'The VC++ runtime uses the Hoard allocator'.

like image 735
David Avatar asked Apr 30 '13 10:04

David


1 Answers

Objective-C uses automatic reference counting (ARC). It's enabled as of iOS5. Apple has US Patent 20030196063 "Transparent local and distributed memory management system".

Java uses a sophisticated garbage collection scheme which has evolved over the years. See "Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine" http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

like image 104
Richard Wеrеzaк Avatar answered Oct 26 '22 03:10

Richard Wеrеzaк