// This structure is placed at the beginning of each addressable page // and has all information we need to find the corresponding memory allocator. struct page_info { char signature[4];
uint32_t type; union { // we use allocated_size for large objects allocator
size_t allocated_size; // and allocator_addr for small ones.
BionicSmallObjectAllocator* allocator_addr;
};
};
// This structure is placed at the beginning of each page managed by // BionicSmallObjectAllocator. Note that a page_info struct is expected at the // beginning of each page as well, and therefore this structure contains a // page_info as its *first* field. struct small_object_page_info {
page_info info; // Must be the first field.
// Doubly linked list for traversing all pages allocated by a // BionicSmallObjectAllocator.
small_object_page_info* next_page;
small_object_page_info* prev_page;
// Linked list containing all free blocks in this page.
small_object_block_record* free_block_list;
// Note that this implementation of realloc never shrinks allocation void* realloc(void* ptr, size_t size); void free(void* ptr);
// Returns the size of the given allocated heap chunk, if it is valid. // Otherwise, this may return 0 or cause a segfault if the pointer is invalid.
size_t get_chunk_size(void* ptr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.