# US 2009/0276602 A1 · Memory management system for reducing memory fragmentation

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2009/0276602 A1
- Document ID: US20090276602A1
- Status: Published application
- Kind: A1
- Application number: 12/295,055
- Filed: 2007-03-23
- Published: 2009-11-05
- Earliest claimed: 1996-10-23
- Assignees: Infovista SA
- Inventors: Olivier Chedru
- Web page: https://patentgrep.com/patent/US20090276602A1

## CPC

- G06F 12/023: {Free address space management}
- G06F 2212/1044: Space efficiency improvement
- G06F 2212/7202: Allocation control and policies
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A memory management system for a process formulated in the C/C++ language in a processing unit includes an allocator which processes memory blocks of predetermined size, for example 64 Kb. Large objects are defined as being objects having a size of between 256 and 64 Kb. For such objects, 64 Kb memory block is considered to be a memory region (“chunk”) able to accommodate several large objects of different sizes. When an object is no longer used by the process, the space freed can be returned to the operating system. Before this, this free space is merged with adjacent free spaces. To search for adjacent free spaces, the Bruijn sequence algorithm is used, applied to the bit field disposed in each predetermined memory region.

## Claims

### Claim 1

A memory management system for a process formulated in the C/C++ language in a processing unit, this system comprising:
an allocator, allocates memory spaces for the objects which the process uses, and of freeing memory spaces which the process does not use to the operating system of the processing unit;
an asynchronous mechanism, which defines a buffer zone consisting of a set of memory blocks which are available for the process, all the memory blocks of said mechanism being of the same size, equal to m*32 kilobytes, where m is between 1 and 4;
each memory block of m*32 kilobytes, originated from said mechanism and used by the process, is managed by the allocator in the form of memory regions, according to the “chunk” memory management technique; for large objects, the size of which is within a predetermined size range, each memory block of m*32 kilobytes is considered as a multi-size memory region (chunk), which includes several of said large objects of different sizes, said multi-size memory region (chunk) containing a header indicating that this is a memory region (chunk) including large objects, a bit field, and a data area comprising small memory blocks in the course of usage and free small memory blocks, the small memory blocks of the multi-size memory region (chunk) being all of the same size; the allocator comprising means of implementing the de Bruijn algorithm, in combination with the bit field technique, to determine the adjacent free blocks, when the process frees a small memory block.

### Claim 2 (depends on 1)

The system according to claim 1, characterized in that the asynchronous mechanism comprises means for reserving a memory block of m*32 kilobytes when a minimum threshold of the number of memory blocks is passed, and means for freeing memory blocks of m*32 kilobytes to the operating system when a maximum threshold of the number of memory blocks is overshot.

### Claim 3

The system according to claim, characterized in that m equals 2.

### Claim 4 (depends on 1)

The system according to claim 1, characterized in that the size of each small memory block is 8 bytes.

### Claim 5 (depends on 1)

The system according to claim 1, characterized in that each small memory block in the course of usage by the process contains an area which includes the object in the course of usage and a header indicating the size of said object in the course of usage.

### Claim 6 (depends on 1)

The system according to claim 1, characterized in that each free small memory block contains a link to the preceding free small memory block, a link to the following small memory block, and a free memory space for data.

### Claim 7 (depends on 1)

The system according to claim 1, characterized in that it also comprises a list, called the free list of large objects, in which are listed, for each size of said predetermined range of sizes, links to free small memory blocks in the multi-size memory regions (chunks).

### Claim 8 (depends on 1)

The system according to claim 1, characterized in that said predetermined range of sizes consists of a range such that 256 bytes<object size≦m*32 kilobytes.

### Claim 9 (depends on 8)

The system according to claim 8, characterized in that for small objects of which the size is less than or equal to 256 bytes, each memory block of m*32 kilobytes which must be used is subdivided into multiple fixed memory segments termed “page chunks”; each fixed memory segment (page chunk) contains a header which includes the size of the objects and an indication of the character, empty or not, of the fixed memory segment (page chunk), and multiple small memory blocks of the same size, each small memory block being free or filled with an object.

### Claim 10 (depends on 9)

The system according to claim 9, characterized in that it also comprises a first free list of small objects associated with the set of fixed memory segments (page chunks), such that for each object size, links to free small memory blocks are established, and in that it also comprises, for each fixed memory segment (page chunk), a second internal free list of small objects, this internal free list comprising links between objects and free small memory blocks within the same fixed memory segment (page chunk); said first and second free lists of small objects are managed by the allocator for allocating and freeing memory.

### Claim 11 (depends on 9)

The system according to claim 9, characterized in that to free an object, the allocator comprises means for implementing the operation of addressing the object to be freed modulo m*32 kilobytes, in such a way as to deduce from it the size of said object to be freed.

### Claim 12 (depends on 9)

The system according to claim 9, characterized in that the allocator comprises means for freeing a memory block of m*32 kilobytes to the operating system when the set of fixed memory segments (page chunks) of this memory block are empty.

### Claim 13 (depends on 1)

The system according to claim 1, characterized in that for huge objects of sizes greater than m*32 kilobytes, the allocator comprises means of fetching from the asynchronous mechanism several memory blocks of m*32 kilobytes, each of a kind to form an oversized memory region (chunk), and each oversized memory region (chunk) containing a header which signals that this is a chunk which contains a huge object.
