Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
59cab94f
Commit
59cab94f
authored
Dec 18, 2013
by
Andrey Pavlenko
Committed by
OpenCV Buildbot
Dec 18, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1997 from alalek:tapi_fix_memleaks
parents
388d0ef1
9cb31e86
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
6 deletions
+16
-6
mat.inl.hpp
modules/core/include/opencv2/core/mat.inl.hpp
+1
-1
matrix.cpp
modules/core/src/matrix.cpp
+7
-1
ocl.cpp
modules/core/src/ocl.cpp
+4
-4
umatrix.cpp
modules/core/src/umatrix.cpp
+4
-0
No files found.
modules/core/include/opencv2/core/mat.inl.hpp
View file @
59cab94f
...
...
@@ -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
View file @
59cab94f
...
...
@@ -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
View file @
59cab94f
...
...
@@ -1524,6 +1524,7 @@ struct Device::Impl
Impl
(
void
*
d
)
{
handle
=
(
cl_device_id
)
d
;
refcount
=
1
;
}
template
<
typename
_TpCL
,
typename
_TpOut
>
...
...
@@ -2784,8 +2785,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
;
}
...
...
@@ -2827,7 +2826,6 @@ public:
u
->
data
=
0
;
u
->
size
=
total
;
u
->
handle
=
handle
;
u
->
urefcount
=
1
;
u
->
flags
=
flags0
;
return
u
;
...
...
@@ -2866,7 +2864,6 @@ public:
}
if
(
accessFlags
&
ACCESS_WRITE
)
u
->
markHostCopyObsolete
(
true
);
CV_XADD
(
&
u
->
urefcount
,
1
);
return
true
;
}
...
...
@@ -2905,6 +2902,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
View file @
59cab94f
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment