1b1994897Sopenharmony_ci# 1. INTRODUCTION 2b1994897Sopenharmony_ci 3b1994897Sopenharmony_ciThe main components of Panda memory management: 4b1994897Sopenharmony_ci* Allocators 5b1994897Sopenharmony_ci* GC 6b1994897Sopenharmony_ci 7b1994897Sopenharmony_ciAllocators has two purposes: 8b1994897Sopenharmony_ci1. Allocations for the application 9b1994897Sopenharmony_ci1. Allocations for the internal usage by Runtime(Allocations for compiler purposes, for GC internal structures etc) 10b1994897Sopenharmony_ci 11b1994897Sopenharmony_ciGarbage Collector: 12b1994897Sopenharmony_ciGarbage collector(GC) automatically recycles memory that it can prove will never be used again. 13b1994897Sopenharmony_ciGC used to recycle memory allocated as result of application work(objects, compiled code etc). 14b1994897Sopenharmony_ci 15b1994897Sopenharmony_ci# 2. OVERALL DESCRIPTION 16b1994897Sopenharmony_ci 17b1994897Sopenharmony_ci## Allocator 18b1994897Sopenharmony_ci 19b1994897Sopenharmony_ci### Alocator Types 20b1994897Sopenharmony_ci- Bump pointer allocator 21b1994897Sopenharmony_ci- Arena Allocator (objects can be deallocated at once(list of arenas, almost at once - O(number of arenas in the list))) 22b1994897Sopenharmony_ci- Freelist allocator 23b1994897Sopenharmony_ci- TLAB 24b1994897Sopenharmony_ci- Run of slots allocator 25b1994897Sopenharmony_ci- Code allocator 26b1994897Sopenharmony_ci 27b1994897Sopenharmony_ci### Spaces 28b1994897Sopenharmony_ci 29b1994897Sopenharmony_ci- Code space (executable) 30b1994897Sopenharmony_ci- Compiler Internal Space(linked list of arenas) 31b1994897Sopenharmony_ci- Internal memory space for non-compiler part of runtime (including GC internals) 32b1994897Sopenharmony_ci- Object space 33b1994897Sopenharmony_ci- Non-moving space(space for non-movable objects) 34b1994897Sopenharmony_ci 35b1994897Sopenharmony_ci## GC 36b1994897Sopenharmony_ci 37b1994897Sopenharmony_ci- Concurrent generational GC (optional - we can disable generational mode) 38b1994897Sopenharmony_ci- GC for classes (optional) 39b1994897Sopenharmony_ci- GC for code cache(optional) 40b1994897Sopenharmony_ci 41b1994897Sopenharmony_ciReference processor. 42b1994897Sopenharmony_ci 43b1994897Sopenharmony_ciHigh level requirements for GC: 44b1994897Sopenharmony_ci- acceptable latency (max pause) for good user experience 45b1994897Sopenharmony_ci- acceptable throughput 46b1994897Sopenharmony_ci- acceptable footprint size 47b1994897Sopenharmony_ci 48b1994897Sopenharmony_ci# 3. KEY FEATURES OF MEMORY MANAGEMENT SYSTEM 49b1994897Sopenharmony_ci 50b1994897Sopenharmony_ciConfigurable flexible setup "Set of allocators + GC" 51b1994897Sopenharmony_ciWe can use profile to choose MM configuration for application (for example: we can choose non-compacting GC with freelist allocators for some application if we get acceptable metrics for this) 52b1994897Sopenharmony_ci 53b1994897Sopenharmony_ci 54b1994897Sopenharmony_ci# 4. INTERACTION WITH OTHER COMPONENTS 55b1994897Sopenharmony_ci 56b1994897Sopenharmony_ci## Allocator 57b1994897Sopenharmony_ci 58b1994897Sopenharmony_ci- allocator API for runtime 59b1994897Sopenharmony_ci- TLAB API for compiler and interpreter 60b1994897Sopenharmony_ci- interfaces for tools? 61b1994897Sopenharmony_ci 62b1994897Sopenharmony_ci## GC 63b1994897Sopenharmony_ci 64b1994897Sopenharmony_ci- Safepoints 65b1994897Sopenharmony_ci- Reference storage and additional interfaces for MM <-> JNI interaction 66b1994897Sopenharmony_ci- Barriers API for compiler and interpreter 67b1994897Sopenharmony_ci- Possibility to change VRegs for any frame in the stack 68b1994897Sopenharmony_ci- interfaces for tools? 69b1994897Sopenharmony_ci 70b1994897Sopenharmony_ci# 5. ADDITIONAL REQUIREMENTS 71b1994897Sopenharmony_ci 72b1994897Sopenharmony_ci- Memory management flexible enough to work with multiple languages. 73b1994897Sopenharmony_ci- provide various statistics data 74b1994897Sopenharmony_ci 75