---
title: DeregisterMem
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/hixlug/llmcrv2_42_27.html
sourcePath: /source/zh/canncommercial/900/API/hixlug/llmcrv2_42_27.html
indexId: accc5aa82d1b7d58424993c49236f39feb263dfd422b67cf2ca9f44f3e313e8b59
---
# DeregisterMem

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | x |
| Atlas 推理系列产品 | x |
| Atlas 训练系列产品 | x |


说明：针对 Atlas A2 训练系列产品 / Atlas A2 推理系列产品 ，仅支持Atlas 800I A2 推理服务器、A200I A2 Box 异构组件。


#### 函数功能

解注册内存。


#### 函数原型

```
Status DeregisterMem(MemHandle mem_handle)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| mem\_handle | 输入 | 调用RegisterMem接口注册内存返回的内存handle。 |


#### 调用示例

单击Gitcode(https://gitcode.com/cann/hixl)，选择配套版本，从“examples/cpp”目录中获取样例。


#### 返回值

- SUCCESS：成功
- PARAM_INVALID：参数错误
- 其他：失败。


#### 异常处理

无


#### 约束说明

- 调用该接口前需要先调用  Disconnect
将所有链路进行断链，确保所有内存不再使用。
- 该接口需要和  Initialize
运行在同一个线程上，如需切换线程调用该接口，需要在  Initialize
所在线程调用“aclrtGetCurrentContext(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclcppdevg_03_0062.html)”获取context，并在新线程调用“aclrtSetCurrentContext(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclcppdevg_03_0061.html)”设置context。
