---
title: MallocWorkSpace
description: "- 头文件：#include <exe_graph/runtime/eager_op_execution_context.h>"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendgraphapi/atlasgeapi_07_0697.html
sourcePath: /source/zh/canncommercial/900/API/ascendgraphapi/atlasgeapi_07_0697.html
indexId: e9bc23b556ec9cccf19305f4a5a8173e3cb354ed44982806b5c7c3fc6e2f853472
---
# MallocWorkSpace

#### 头文件/库文件

- 头文件：#include <exe_graph/runtime/eager_op_execution_context.h>
- 库文件：liblowering.so


#### 功能说明

分配Workspace内存，Placement为Device。

内存由context构造方管理，接口调用者不需要主动释放。


#### 函数原型

```
void *MallocWorkSpace(size_t size)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| size | 输入 | 内存大小，单位为字节。 |


#### 返回值说明

地址指针，异常时返回空指针。


#### 约束说明

无
