summaryrefslogtreecommitdiffstats
path: root/linker/linker_block_allocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'linker/linker_block_allocator.h')
-rw-r--r--linker/linker_block_allocator.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/linker/linker_block_allocator.h b/linker/linker_block_allocator.h
index 1d41806..4b9b995 100644
--- a/linker/linker_block_allocator.h
+++ b/linker/linker_block_allocator.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef __LINKER_ALLOCATOR_H
-#define __LINKER_ALLOCATOR_H
+#ifndef __LINKER_BLOCK_ALLOCATOR_H
+#define __LINKER_BLOCK_ALLOCATOR_H
#include <stdlib.h>
#include <limits.h>
@@ -24,11 +24,11 @@
struct LinkerBlockAllocatorPage;
/*
- * This class is a non-template version of the LinkerAllocator
+ * This class is a non-template version of the LinkerTypeAllocator
* It keeps code inside .cpp file by keeping the interface
* template-free.
*
- * Please use LinkerAllocator<type> where possible (everywhere).
+ * Please use LinkerTypeAllocator<type> where possible (everywhere).
*/
class LinkerBlockAllocator {
public:
@@ -50,11 +50,21 @@ class LinkerBlockAllocator {
};
/*
- * We can't use malloc(3) in the dynamic linker.
- *
* A simple allocator for the dynamic linker. An allocator allocates instances
* of a single fixed-size type. Allocations are backed by page-sized private
* anonymous mmaps.
+ *
+ * The differences between this allocator and LinkerMemoryAllocator are:
+ * 1. This allocator manages space more efficiently. LinkerMemoryAllocator
+ * operates in power-of-two sized blocks up to 1k, when this implementation
+ * splits the page to aligned size of structure; For example for structures
+ * with size 513 this allocator will use 516 (520 for lp64) bytes of data
+ * where generalized implementation is going to use 1024 sized blocks.
+ *
+ * 2. This allocator does not munmap allocated memory, where LinkerMemoryAllocator does.
+ *
+ * 3. This allocator provides mprotect services to the user, where LinkerMemoryAllocator
+ * always treats it's memory as READ|WRITE.
*/
template<typename T>
class LinkerTypeAllocator {
@@ -68,4 +78,4 @@ class LinkerTypeAllocator {
DISALLOW_COPY_AND_ASSIGN(LinkerTypeAllocator);
};
-#endif // __LINKER_ALLOCATOR_H
+#endif // __LINKER_BLOCK_ALLOCATOR_H