---
title: 函数：free_host
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_0117.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0117.html
indexId: 5128793bd4aaa0aeb2c89b1c9a8578c1594cb6fa2a421c2e5303a18f184c836a71
---
# 函数：free_host

#### 产品支持情况

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


#### 功能说明

释放Host上的内存。


#### 函数原型

- C函数原型
  1 aclError aclrtFreeHost(void *hostPtr)

- python函数
  1 ret= acl.rt.free_host(host_ptr)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| host\_ptr | int，待释放内存的指针地址。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |


#### 约束说明

- 本接口会立刻释放传入的内存，函数内部不会进行隐式的Device同步或流同步。用户需要确保调用完本接口后不再对该内存指针地址进行访问。
- acl.rt.free_host接口只能释放通过  acl.rt.malloc_host
接口申请的内存。
