• Home
Name Date Size #Lines LOC

..--

figures/12-May-2024-

libdmabufheap/12-May-2024-508343

LICENSED12-May-20249.9 KiB178150

OAT.xmlD12-May-20241.1 KiB2810

README.mdD12-May-20243.6 KiB7953

README_ZH.mdD12-May-20243.1 KiB8054

bundle.jsonD12-May-2024660 3131

README.md

1# The Part of Memory Base Libraries
2
3-   [Introduction](#section_introduction)
4-   [Architecture](#section_architecture)
5-   [Directory Structure](#section_catalogue)
6-   [Memory Base Libraries](#section_libraries)
7    -   [libdmabufheap system library](#section_libdmabufheap)
8    -   [libmeminfo system library (planning)](#section_libmeminfo)
9    -   [libmemleak system library (planning)](#section_libmemleak)
10    -   [libpurgeable system library (planning)](#section_libpurgeable)
11    -   [libspeculative system library (planning)](#section_libspeculative)
12-   [Usage Guidelines](#section_usage)
13-   [Repositories Involved](#section_projects)
14
15## Introduction<a name="section_introduction"></a>
16
17The part of *Memory base libraries* belongs to the subsystem named *Utils Subsystem*. It provides the system library for upper-layer services to operate memory, ensuring the stability of upper-layer services.
18
19## Architecture<a name="section_architecture"></a>
20
21**Figure  1** Memory Base Libraries architecture
22
23![](figures/en-us_image_fwk.png)
24
25| Memory Base Libraries | User                  |
26| -------------- | -------------------------- |
27| libdmabufheap  | multimedia service      |
28| libmeminfo     | memory manager service         |
29| libmemleak     | memory manager service         |
30| libpurgeable   | graphic service (planning) |
31| libspeculative | system service (planning) |
32
33## Directory Structure<a name="section_catalogue"></a>
34
35```
36/utils/memory
37├── libdmabufheap           # DMA (Direct Memory Access) memory allocation system library
38│   ├── include             # DMA memory allocation system library header directory
39│   ├── src                 # DMA memory allocation system library source directory
40│   └── test                # DMA memory allocation system library usecase directory
41├── libmeminfo              # Memory footprint management library
42├── libmemleak              # Memory leak detection library
43├── libpurgeable            # Purgeable memory management library
44└── libspeculative          # Speculative memory management library
45```
46
47## Memory Base Libraries<a name="section_libraries"></a>
48
49*Memory base libraries* is a component of the system library that integrates memory operations and manages them in a unified manner.
50
51### libdmabufheap system library<a name="section_libdmabufheap"></a>
52
53The memory system library provides interfaces for the multimedia service to allocate and share shared memory. By allocating and sharing memory between hardware devices and user space, zero-copy memory between devices and processes is implemented to improve execution efficiency.
54
55### libmeminfo system library (planning)<a name="section_libmeminfo"></a>
56
57It provides interfaces for memory usage queries. It is used for memory footprint query, low memory killing and other scenarios.
58
59### libmemleak system library (planning)<a name="section_libmemleak"></a>
60
61It cooperates with malloc_debug to detect memory leaks of native heap.
62
63### libpurgeable system library (planning)<a name="section_libpurgeable"></a>
64
65It provides management interfaces for discardable-type memory.
66
67### libspeculative system library (planning)<a name="section_libspeculative"></a>
68
69It provides management interfaces for speculative-type memory. It is mainly used by system services for data pre-loading.
70
71## Usage Guidelines<a name="section_usage"></a>
72
73System developers can add or remove this part by configuring the product definition JSON file under **/productdefine/common/products** to enable or disable this part:
74
75` "utils:utils_memory":{} `
76
77## Repositories Involved<a name="section_projects"></a>
78
79[utils](https://gitee.com/openharmony/utils)

README_ZH.md

1# 内存基础库部件
2
3-   [简介](#section_introduction)
4-   [部件架构](#section_architecture)
5-   [目录](#section_catalogue)
6-   [内存基础库](#section_libraries)
7    -   [libdmabufheap系统库](#section_libdmabufheap)
8    -   [libmeminfo系统库(规划中)](#section_libmeminfo)
9    -   [libmemleak系统库(规划中)](#section_libmemleak)
10    -   [libpurgeable系统库(规划中)](#section_libpurgeable)
11    -   [libspeculative系统库(规划中)](#section_libspeculative)
12-   [使用说明](#section_usage)
13-   [相关仓](#section_projects)
14
15## 简介<a name="section_introduction"></a>
16
17内存基础库部件位于公共基础库子系统中,为上层业务提供对应的操作内存的系统库,保证上层业务的稳定性。
18
19## 部件架构<a name="section_architecture"></a>
20
21**图1** 内存基础库部件架构图
22
23![](figures/zh-cn_image_fwk.png)
24
25| 内存基础库 | 使用者                  |
26| -------------- | -------------------------- |
27| libdmabufheap  | 多媒体相关服务      |
28| libmeminfo     | 内存管理服务         |
29| libmemleak     | 内存管理服务         |
30| libpurgeable   | 图形图像相关服务(规划中) |
31| libspeculative | 系统服务(规划中) |
32
33## 目录<a name="section_catalogue"></a>
34
35```
36/utils/memory
37├── libdmabufheap           # DMA (Direct Memory Access) 内存分配链接库
38│   ├── include             # DMA内存分配链接库头文件目录
39│   ├── src                 # DMA内存分配链接库源代码目录
40│   └── test                # DMA内存分配链接库自测用例目录
41├── libmeminfo              # 内存占用查询库
42├── libmemleak              # 内存泄漏检测库
43├── libpurgeable            # 可丢弃类型内存管理库
44└── libspeculative          # 投机类型内存管理库
45```
46
47## 内存基础库<a name="section_libraries"></a>
48
49内存基础库是集成内存操作的系统库的部件,对内存操作的系统库进行统一管理。
50
51### libdmabufheap系统库<a name="section_libdmabufheap"></a>
52
53为多媒体相关服务提供分配共享内存的接口,通过在硬件设备和用户空间之间分配和共享内存,实现
54设备、进程间零拷贝内存,提升执行效率。
55
56### libmeminfo系统库(规划中)<a name="section_libmeminfo"></a>
57
58提供内存占用查询接口,用于内存占用信息查询、低内存查杀等场景。
59
60### libmemleak系统库(规划中)<a name="section_libmemleak"></a>
61
62配合malloc_debug做native heap内存泄漏检测。
63
64### libpurgeable系统库(规划中)<a name="section_libpurgeable"></a>
65
66提供可丢弃类型内存的管理接口。
67
68### libspeculative系统库(规划中)<a name="section_libspeculative"></a>
69
70提供投机类型内存管理接口,用于缓存预读。
71
72## 使用说明<a name="section_usage"></a>
73
74系统开发者可以通过配置productdefine/common/products下的产品定义json文件,增加或移除本部件,来启用或停用本部件。
75
76` "utils:utils_memory":{} `
77
78## 相关仓<a name="section_projects"></a>
79
80[公共基础库子系统](https://gitee.com/openharmony/utils)