Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
9d40eb3d
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9d40eb3d
编写于
6月 05, 2018
作者:
X
Xin Pan
提交者:
GitHub
6月 05, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11180 from jacquesqiao/cherry-pick-fix-memory-pick-to-0.13.0
fix protobuf memory leak (#11177)
上级
12e873b9
7fb06a5f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
4 addition
and
33 deletion
+4
-33
paddle/fluid/framework/block_desc.cc
paddle/fluid/framework/block_desc.cc
+4
-24
paddle/fluid/framework/block_desc.h
paddle/fluid/framework/block_desc.h
+0
-9
未找到文件。
paddle/fluid/framework/block_desc.cc
浏览文件 @
9d40eb3d
...
@@ -169,17 +169,13 @@ void BlockDesc::Flush() {
...
@@ -169,17 +169,13 @@ void BlockDesc::Flush() {
}
}
if
(
need_update_
)
{
if
(
need_update_
)
{
auto
&
op_field
=
*
this
->
desc_
->
mutable_ops
();
this
->
desc_
->
mutable_ops
()
->
Clear
();
this
->
ClearPBOps
();
op_field
.
Reserve
(
static_cast
<
int
>
(
ops_
.
size
()));
for
(
auto
&
op_desc
:
ops_
)
{
for
(
auto
&
op_desc
:
ops_
)
{
op_field
.
AddAllocated
(
op_desc
->
Proto
());
this
->
desc_
->
mutable_ops
()
->
Add
()
->
CopyFrom
(
*
op_desc
->
Proto
());
}
}
auto
&
var_field
=
*
this
->
desc_
->
mutable_vars
();
this
->
desc_
->
mutable_vars
()
->
Clear
();
this
->
ClearPBVars
();
var_field
.
Reserve
(
static_cast
<
int
>
(
vars_
.
size
()));
for
(
auto
&
var_desc
:
vars_
)
{
for
(
auto
&
var_desc
:
vars_
)
{
var_field
.
AddAllocated
(
var_desc
.
second
->
Proto
());
this
->
desc_
->
mutable_vars
()
->
Add
()
->
CopyFrom
(
*
var_desc
.
second
->
Proto
());
}
}
need_update_
=
false
;
need_update_
=
false
;
}
}
...
@@ -217,22 +213,6 @@ BlockDesc::BlockDesc(const BlockDesc &other, proto::BlockDesc *desc,
...
@@ -217,22 +213,6 @@ BlockDesc::BlockDesc(const BlockDesc &other, proto::BlockDesc *desc,
}
}
}
}
void
BlockDesc
::
ClearPBOps
()
{
auto
ops
=
this
->
desc_
->
mutable_ops
();
while
(
!
ops
->
empty
())
{
// we do not own the OpDesc, so release the ownership.
ops
->
ReleaseLast
();
}
}
void
BlockDesc
::
ClearPBVars
()
{
auto
vars
=
this
->
desc_
->
mutable_vars
();
while
(
!
vars
->
empty
())
{
// we do not own the VarDesc, so release the ownership.
vars
->
ReleaseLast
();
}
}
void
BlockDesc
::
SetForwardBlockID
(
int32_t
forward_block_id
)
{
void
BlockDesc
::
SetForwardBlockID
(
int32_t
forward_block_id
)
{
PADDLE_ENFORCE
(
!
desc_
->
has_forward_block_idx
(),
PADDLE_ENFORCE
(
!
desc_
->
has_forward_block_idx
(),
"Parent block ID has been set to %d. Cannot set to %d"
,
"Parent block ID has been set to %d. Cannot set to %d"
,
...
...
paddle/fluid/framework/block_desc.h
浏览文件 @
9d40eb3d
...
@@ -41,11 +41,6 @@ class BlockDesc {
...
@@ -41,11 +41,6 @@ class BlockDesc {
BlockDesc
(
const
BlockDesc
&
other
,
proto
::
BlockDesc
*
desc
,
ProgramDesc
*
prog
);
BlockDesc
(
const
BlockDesc
&
other
,
proto
::
BlockDesc
*
desc
,
ProgramDesc
*
prog
);
~
BlockDesc
()
{
this
->
ClearPBVars
();
this
->
ClearPBOps
();
}
int32_t
ID
()
const
{
return
desc_
->
idx
();
}
int32_t
ID
()
const
{
return
desc_
->
idx
();
}
int32_t
Parent
()
const
{
return
desc_
->
parent_idx
();
}
int32_t
Parent
()
const
{
return
desc_
->
parent_idx
();
}
...
@@ -113,10 +108,6 @@ class BlockDesc {
...
@@ -113,10 +108,6 @@ class BlockDesc {
ProgramDesc
*
Program
()
const
{
return
this
->
prog_
;
}
ProgramDesc
*
Program
()
const
{
return
this
->
prog_
;
}
private:
void
ClearPBOps
();
void
ClearPBVars
();
private:
private:
ProgramDesc
*
prog_
;
// not_own
ProgramDesc
*
prog_
;
// not_own
proto
::
BlockDesc
*
desc_
;
// not_own
proto
::
BlockDesc
*
desc_
;
// not_own
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录