Overview There are three things garbage collection needs to accomplish: What memory needs to be recycled? When will it be recycled? How to recycle? Algorithm for determining whether objects are alive: Reference counting method: Add a reference counter to the object. Whenever there is a reference, the counter value is incremented by 1; when the […]
Tag: allocation
Linux memory management–physical memory allocation
1. First Fit Dispenser The First Fit allocator is the most basic memory allocator, which uses a bitmap instead of a list of free blocks to represent memory. In the bitmap, if the corresponding bit of the page is 1, it means that the page has been allocated, and if it is 0, it means […]
Lab5: Lazy Page Allocation | Lazy allocation of memory pages
Lab 5: Lazy Page Allocation One of the many neat tricks an O/S can play with page table hardware is lazy allocation of user-space heap memory. Xv6 applications ask the kernel for heap memory using the sbrk() system call. In the kernel we’ve given you , sbrk() allocates physical memory and maps it into the […]
Activiti process instances and task allocation
Article directory 1. Process examples 1.1. What is a process instance? 1.2. Associate the actual business with the activiti table (BusinessKey) 1.3. Suspend and activate process instance 1.3.1. All process instances hang 1.3.2. A single process instance hangs 2. Task allocation 2.1. Fixed allocation 2.2. UEL expression distribution 2.2.1. UEL-value method 2.2.2, UEL-method method 2.3. […]
Dynamic memory allocation (stdlib.h must be included when using)
1. Dynamic memory function-malloc void malloc(size_t size); The malloc function applies for a continuous available space in memory and returns a pointer to this space. ① If the space is successfully opened, a pointer to the opened space will be returned. ② If the space opening fails, a NULL pointer will be returned, so the […]
Address book (structure and dynamic memory allocation example)
Implement an address book; Address book can be used to store information. Each person’s information includes: name, gender, age, phone number, and address. Provide method: Add contact information Delete specified contact information Find specific contact information Modify designated contact information Show all contact information Clear all contacts Sort all contacts by first name 1. The […]
Linux system programming_process: C program space allocation, (v)fork, wait, exec, system, popen
1. Process related concepts (414.1) Question 1. What is a program, what is a process, and what is the difference? Program is a static concept, gcc xxx.c –o pro, the pro file is generated on the disk, which is called a program A process is a running activity of a program. In simple terms, when […]
Embedded Development Plan-37—-C++ Memory Dynamic Allocation and Recycling–Special Member Functions in C++ Classes
Eighty-five, C++ memory dynamic allocation and recycling Dynamic memory allocation and recycling in C language is done using malloc and free. This can also be done in C++ using the above two functions. C++ also provides users with two keywords for dynamic memory allocation and recycling new and delete 85.1 Allocation single memory allocation Format: […]
Understand the memory allocation method in Rust by customizing Vec<T>
In Rust, memory is generally allocated through syscall. You can customize the memory allocation algorithm, implement GlobalAlloc trait, and tell the compiler the customized memory allocation algorithm through the #[global_allocator] annotation. alloc and Layout in action Before we dive in, let’s get a basic idea of Rust memory allocation using alloc, dealloc and Layout through […]
31|Behind new and delete: allocation function and release function
The most commonly used allocation and release functions In Lecture 1, I mentioned that when we use new and delete to create and destroy objects, there are actually quite a lot of things happening (if you forget, you can review it). Among them, the operations of allocating memory and releasing memory are completed through the […]