---
title: kupl_hbw_free
description: "取消锁定OPM内存，并释放OPM内存。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_079.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/KunpengHPCKit_developer_079.html
indexId: ca2c7f90480a08f2488c25b77ad7eb22921847ef107061fa4d311fd960516a2067
---
# kupl_hbw_free

取消锁定OPM内存，并释放OPM内存。

#### 接口定义

void kupl_hbw_free(void *ptr);


#### 参数


**表1 参数定义**

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| ptr | void\* | 需要释放的OPM内存的指针 | 输入 |


#### 示例

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

int main() 
{ 
    int len = 1024; 
    char *data = (char *)kupl_hbw_malloc(len);
    if (data == nullptr) {
        return 0;
    }
    kupl_hbw_free(data); 
    return 0; 
}
```


- 上述示例演示了申请锁住的OPM内存并释放该内存的流程。
- 上述kupl_hbw_free函数取消data指向的内存锁定并释放内存。
- kupl_hbw_free函数会在发现内存被内存锁定机制锁定时取消锁定，并释放内存；否则直接释放内存。
