Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
9cb31e86
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9cb31e86
编写于
12月 16, 2013
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
umat: fix memory leaks
上级
11071dd2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
6 deletion
+16
-6
modules/core/include/opencv2/core/mat.inl.hpp
modules/core/include/opencv2/core/mat.inl.hpp
+1
-1
modules/core/src/matrix.cpp
modules/core/src/matrix.cpp
+7
-1
modules/core/src/ocl.cpp
modules/core/src/ocl.cpp
+4
-4
modules/core/src/umatrix.cpp
modules/core/src/umatrix.cpp
+4
-0
未找到文件。
modules/core/include/opencv2/core/mat.inl.hpp
浏览文件 @
9cb31e86
...
...
@@ -617,9 +617,9 @@ inline void Mat::release()
{
if
(
u
&&
CV_XADD
(
&
u
->
refcount
,
-
1
)
==
1
)
deallocate
();
u
=
NULL
;
data
=
datastart
=
dataend
=
datalimit
=
0
;
size
.
p
[
0
]
=
0
;
u
=
0
;
}
inline
...
...
modules/core/src/matrix.cpp
浏览文件 @
9cb31e86
...
...
@@ -56,7 +56,10 @@ void MatAllocator::map(UMatData*, int) const
void
MatAllocator
::
unmap
(
UMatData
*
u
)
const
{
if
(
u
->
urefcount
==
0
&&
u
->
refcount
==
0
)
{
deallocate
(
u
);
u
=
NULL
;
}
}
void
MatAllocator
::
download
(
UMatData
*
u
,
void
*
dstptr
,
...
...
@@ -179,7 +182,6 @@ public:
UMatData
*
u
=
new
UMatData
(
this
);
u
->
data
=
u
->
origdata
=
data
;
u
->
size
=
total
;
u
->
refcount
=
data0
==
0
;
if
(
data0
)
u
->
flags
|=
UMatData
::
USER_ALLOCATED
;
...
...
@@ -195,6 +197,8 @@ public:
void
deallocate
(
UMatData
*
u
)
const
{
CV_Assert
(
u
->
urefcount
>=
0
);
CV_Assert
(
u
->
refcount
>=
0
);
if
(
u
&&
u
->
refcount
==
0
)
{
if
(
!
(
u
->
flags
&
UMatData
::
USER_ALLOCATED
)
)
...
...
@@ -392,6 +396,7 @@ void Mat::create(int d, const int* _sizes, int _type)
CV_Assert
(
step
[
dims
-
1
]
==
(
size_t
)
CV_ELEM_SIZE
(
flags
)
);
}
addref
();
finalizeHdr
(
*
this
);
}
...
...
@@ -409,6 +414,7 @@ void Mat::deallocate()
{
if
(
u
)
(
u
->
currAllocator
?
u
->
currAllocator
:
allocator
?
allocator
:
getStdAllocator
())
->
unmap
(
u
);
u
=
NULL
;
}
Mat
::
Mat
(
const
Mat
&
m
,
const
Range
&
_rowRange
,
const
Range
&
_colRange
)
...
...
modules/core/src/ocl.cpp
浏览文件 @
9cb31e86
...
...
@@ -1469,6 +1469,7 @@ struct Device::Impl
Impl
(
void
*
d
)
{
handle
=
(
cl_device_id
)
d
;
refcount
=
1
;
}
template
<
typename
_TpCL
,
typename
_TpOut
>
...
...
@@ -2693,8 +2694,6 @@ public:
UMatData
*
defaultAllocate
(
int
dims
,
const
int
*
sizes
,
int
type
,
void
*
data
,
size_t
*
step
,
int
flags
)
const
{
UMatData
*
u
=
matStdAllocator
->
allocate
(
dims
,
sizes
,
type
,
data
,
step
,
flags
);
u
->
urefcount
=
1
;
u
->
refcount
=
0
;
return
u
;
}
...
...
@@ -2736,7 +2735,6 @@ public:
u
->
data
=
0
;
u
->
size
=
total
;
u
->
handle
=
handle
;
u
->
urefcount
=
1
;
u
->
flags
=
flags0
;
return
u
;
...
...
@@ -2775,7 +2773,6 @@ public:
}
if
(
accessFlags
&
ACCESS_WRITE
)
u
->
markHostCopyObsolete
(
true
);
CV_XADD
(
&
u
->
urefcount
,
1
);
return
true
;
}
...
...
@@ -2814,6 +2811,9 @@ public:
if
(
!
u
)
return
;
CV_Assert
(
u
->
urefcount
>=
0
);
CV_Assert
(
u
->
refcount
>=
0
);
// TODO: !!! when we add Shared Virtual Memory Support,
// this function (as well as the others) should be corrected
CV_Assert
(
u
->
handle
!=
0
&&
u
->
urefcount
==
0
);
...
...
modules/core/src/umatrix.cpp
浏览文件 @
9cb31e86
...
...
@@ -217,6 +217,7 @@ UMat Mat::getUMat(int accessFlags) const
if
(
!
a
)
a
=
a0
;
temp_u
=
a
->
allocate
(
dims
,
size
.
p
,
type
(),
data
,
step
.
p
,
accessFlags
);
temp_u
->
refcount
=
1
;
}
UMat
::
getStdAllocator
()
->
allocate
(
temp_u
,
accessFlags
);
hdr
.
flags
=
flags
;
...
...
@@ -224,6 +225,7 @@ UMat Mat::getUMat(int accessFlags) const
finalizeHdr
(
hdr
);
hdr
.
u
=
temp_u
;
hdr
.
offset
=
data
-
datastart
;
hdr
.
addref
();
return
hdr
;
}
...
...
@@ -271,6 +273,7 @@ void UMat::create(int d, const int* _sizes, int _type)
}
finalizeHdr
(
*
this
);
addref
();
}
void
UMat
::
copySize
(
const
UMat
&
m
)
...
...
@@ -294,6 +297,7 @@ UMat::~UMat()
void
UMat
::
deallocate
()
{
u
->
currAllocator
->
deallocate
(
u
);
u
=
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录