Personal homepage: Xiu Xiu Ye Column: C language Operating environment:Visual Studio 2022 ? Table of Contents What is dynamic allocation of memory? Memory dynamic allocation function malloc() calloc() realloc() Dynamic memory release function free() Common dynamic memory errors 1. Dereference operation of NULL pointer 2. Out-of-bounds access to dynamically opened space 3. Use free release […]
Tag: alloc
Install GMP, NTL, CTMalloc and compile OpenFHE
references: [ABB + 22] Al Badawi A, Bates J, Bergamaschi F, et al. Openfhe: Open-source fully homomorphic encryption library[C]//Proceedings of the 10th Workshop on Encrypted Computing & Applied Homomorphic Cryptography. 2022: 53 -63. openfheorg/openfhe-development Welcome to OpenFHE’s documentation! Install NTL library and compile and test on Ubuntu Install NTL library on Ubuntu Memory Optimization-How to […]
Linux physical page allocation algorithm—-partner algorithm
Foreword The content of this chapter focuses on the partner algorithm in the Linux physical page allocation algorithm. However, it is a bit too far-fetched to directly introduce this algorithm, so we first analyze when physical page allocation starts: (The source code in this article is from kernel version 5.15) Linux uses the “request paging” […]
Garbage collector and memory allocation strategy
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 […]
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 […]
29. Blocked memory management [malloc, free]
There are many ways to implement memory management, but in the end they all need to implement two functions: malloc and free. The malloc function is used for memory application, and the free function is used for memory release. This article implements this through block memory management: It’s just that the allocation direction in the […]
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 […]