From 5eb381a3e2002e5e7f5e152a4b7579a1fea0ac86 Mon Sep 17 00:00:00 2001 From: Zeng Jinle <32832641+sneaxiy@users.noreply.github.com> Date: Wed, 18 Sep 2019 19:14:15 +0800 Subject: [PATCH] refine reallocate of workspace size, test=develop (#19843) --- paddle/fluid/platform/device_context.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paddle/fluid/platform/device_context.h b/paddle/fluid/platform/device_context.h index bdc2670dc2..77443c72be 100644 --- a/paddle/fluid/platform/device_context.h +++ b/paddle/fluid/platform/device_context.h @@ -218,6 +218,8 @@ class CudnnWorkspaceHandle { if (required_workspace_bytes <= WorkspaceSize()) { return; } + // reset allocation first before re-allocate to save memory + allocation_.reset(); allocation_ = memory::Alloc(device_context_, required_workspace_bytes); } -- GitLab