diff --git a/README.en.md b/README.en.md index acde9b4f1fa20a88959fd232b012310646a7c014..af6dead5a6c11182b399138ea85e77bf535fa647 100644 --- a/README.en.md +++ b/README.en.md @@ -1,37 +1,71 @@ -# The Part of Memory System Library +# The Part of Memory Base Libraries - [Introduction](#section_introduction) +- [Architecture](#section_architecture) - [Directory Structure](#section_catalogue) -- [Memory System Library](#section_libraries) +- [Memory Base Libraries](#section_libraries) - [libdmabufheap system library](#section_libdmabufheap) + - [libmeminfo system library (in planning)](#section_libmeminfo) + - [libmemleak system library (in planning)](#section_libmemleak) + - [libpurgeable system library (in planning)](#section_libpurgeable) + - [libspeculative system library (in planning)](#section_libspeculative) - [Usage Guidelines](#section_usage) +- [Repositories Involved](#section_projects) ## Introduction -The part of *Memory system Library* 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. +The 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. + +## Architecture + +![](figures/en-us_image_fwk.png) + +**Figure 1** Memory Base Libraries architecture ## Directory Structure ``` /utils/memory -└── libdmabufheap # DMA memory allocation system library -    ├── BUILD.gn -    ├── include # DMA memory allocation system library header directory -    │   └── dmabuf_alloc.h -    ├── src # DMA memory allocation system library source directory -    │   └── dmabuf_alloc.c -    └── test # DMA memory allocation system library usecase directory +├── libdmabufheap # DMA (Direct Memory Access) memory allocation system library +│   ├── include # DMA memory allocation system library header directory +│   ├── src # DMA memory allocation system library source directory +│   └── test # DMA memory allocation system library usecase directory +├── libmeminfo # Memory footprint management library +├── libmemleak # Memory leak detection library +├── libpurgeable # Purgeable memory management library +└── libspeculative # Speculative memory management library ``` -## Memory System Libraries -The memory system library is a component of the system library that integrates memory operations and manages them in a unified manner. +## Memory Base Libraries + +*Memory base libraries* is a component of the system library that integrates memory operations and manages them in a unified manner. ### libdmabufheap system library The memory system library provides interfaces for services 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. +### libmeminfo system library (in planning) + +It provides interfaces for memory usage queries. It is mainly used by memory footprint management service(hidumper) and low-memory killing service(lmks). + +### libmemleak system library (in planning) + +It cooperates with malloc_debug to detect memory leaks of native heap. + +### libpurgeable system library (in planning) + +It provides management interfaces for discardable-type memory. It is mainly used by graphics and image codec libraries. + +### libspeculative system library (in planning) + +It provides management interfaces for speculative-type memory. It is mainly used by system services for data pre-loading. + ## Usage Guidelines System developers can add or remove this part by configuring the product definition JSON file under **/productdefine/common/products** to enable or disable this part: -` "utils:utils_memory":{} ` \ No newline at end of file +` "utils:utils_memory":{} ` + +## Repositories Involved + +[utils](https://gitee.com/openharmony/utils) \ No newline at end of file diff --git a/README.md b/README.md index 0df06af7acde0d8670eaebf8fa5165ab5399b4fc..3f5d21dfb56b5ac4ef7ca7329676b9965daa7055 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,72 @@ -# 内存系统库 +# 内存基础库部件 - [简介](#section_introduction) +- [部件架构图](#section_architecture) - [目录](#section_catalogue) -- [内存系统库](#section_libraries) +- [内存基础库](#section_libraries) - [libdmabufheap系统库](#section_libdmabufheap) + - [libmeminfo系统库(规划)](#section_libmeminfo) + - [libmemleak系统库(规划)](#section_libmemleak) + - [libpurgeable系统库(规划)](#section_libpurgeable) + - [libspeculative系统库(规划)](#section_libspeculative) - [使用说明](#section_usage) +- [相关仓](#section_projects) ## 简介 -内存系统库部件位于公共基础库子系统中,为上层业务提供对应的操作内存的系统库,保证上层业务的稳定性。 +内存基础库部件位于公共基础库子系统中,为上层业务提供对应的操作内存的系统库,保证上层业务的稳定性。 + +## 部件架构图 + +![](figures/zh-cn_image_fwk.png) + +**图1** 内存基础库部件架构图 ## 目录 ``` /utils/memory -└── libdmabufheap # DMA内存分配链接库 -    ├── BUILD.gn -    ├── include # DMA内存分配链接库头文件目录 -    │   └── dmabuf_alloc.h -    ├── src # DMA内存分配链接库源代码目录 -    │   └── dmabuf_alloc.c -    └── test # DMA内存分配链接库自测用例目录 +├── libdmabufheap # DMA (Direct Memory Access) 内存分配链接库 +│   ├── include # DMA内存分配链接库头文件目录 +│   ├── src # DMA内存分配链接库源代码目录 +│   └── test # DMA内存分配链接库自测用例目录 +├── libmeminfo # 内存占用查询库 +├── libmemleak # 内存泄漏检测库 +├── libpurgeable # 可丢弃类型内存管理库 +└── libspeculative # 投机类型内存管理库 ``` -## 内存系统库 -内存系统库是集成内存操作的系统库的部件,对内存操作的系统库进行统一管理。 +## 内存基础库 + +内存基础库是集成内存操作的系统库的部件,对内存操作的系统库进行统一管理。 ### libdmabufheap系统库 为业务提供分配共享内存的接口,通过在硬件设备和用户空间之间分配和共享内存,实现 设备、进程间零拷贝内存,提升执行效率。 +### libmeminfo系统库(规划) + +提供内存占用查询接口。主要提供给内存占用维测(hidumper)、低内存查杀服务(lmks)使用。 + +### libmemleak系统库(规划) + +配合malloc_debug做native heap内存泄漏检测。 + +### libpurgeable系统库(规划) + +提供可丢弃类型内存的管理接口。主要提供给多媒体业务图形图像编解码库使用。 + +### libspeculative系统库(规划) + +提供投机类型内存管理接口。主要提供给系统服务使用,用于缓存预读。 + ## 使用说明 系统开发者可以通过配置productdefine/common/products下的产品定义json文件,增加或移除本部件,来启用或停用本部件。 -` "utils:utils_memory":{} ` \ No newline at end of file +` "utils:utils_memory":{} ` + +## 相关仓 + +[公共基础库子系统](https://gitee.com/openharmony/utils) \ No newline at end of file diff --git a/figures/en-us_image_fwk.png b/figures/en-us_image_fwk.png new file mode 100644 index 0000000000000000000000000000000000000000..b1d0e4711ad2729334fe151c4c0f4ecf37b7d39a Binary files /dev/null and b/figures/en-us_image_fwk.png differ diff --git a/figures/zh-cn_image_fwk.png b/figures/zh-cn_image_fwk.png new file mode 100644 index 0000000000000000000000000000000000000000..09921e55e0d55aa6406e2d2afc058fbba48f4482 Binary files /dev/null and b/figures/zh-cn_image_fwk.png differ