---
title: kupl_munlock
description: "取消锁定内存页表。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_069.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_069.html
indexId: 403322274d4c5162de405057b5bb96ec7117c1ad3810e645625fec08c896c9e367
---
# kupl_munlock

取消锁定内存页表。

#### 接口定义

int kupl_munlock(void *buffer, size_t count);


#### 参数


**表1 参数定义**

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| buffer | void\* | 需要取消锁定的内存指针 | 输入 |
| count | size\_t | 需要取消锁定的内存大小 | 输入 |


#### 返回值

- 成功：返回KUPL_OK
- 失败：返回KUPL_ERROR


#### 示例

```
#include <stdio.h> 
#include <stdlib.h>
#include "kupl.h" 

int main() 
{ 
    int len = 1024; 
    char *data = (char *)malloc(len);
    if (data == nullptr) {
        return 0;
    }
    kupl_mlock(data, len);
    kupl_munlock(data, len);
    free(data);
    return 0; 
}
```

- 上述示例演示了申请内存、锁住内存、取消锁定并最终释放内存的流程。
- 上述kupl_munlock函数用于取消锁定data指向的内存。
- kupl_munlock函数会取消锁定内存。其中环境中包含sdma设备是成功取消锁定的必要条件。
