Skip to content

Commit 5eb381a

Browse files
authored
refine reallocate of workspace size, test=develop (#19843)
1 parent 71b2ed6 commit 5eb381a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

paddle/fluid/platform/device_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ class CudnnWorkspaceHandle {
218218
if (required_workspace_bytes <= WorkspaceSize()) {
219219
return;
220220
}
221+
// reset allocation first before re-allocate to save memory
222+
allocation_.reset();
221223
allocation_ = memory::Alloc(device_context_, required_workspace_bytes);
222224
}
223225

0 commit comments

Comments
 (0)