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
3a53d866
Commit
3a53d866
authored
Jan 25, 2011
by
James Bowman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#489, leaking cvarrmat test and fix
parent
68ed806b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
cv.cpp
modules/python/cv.cpp
+12
-1
leak4.py
tests/python/leak4.py
+9
-0
No files found.
modules/python/cv.cpp
View file @
3a53d866
...
...
@@ -1734,11 +1734,21 @@ static int convert_to_pts_npts_contours(PyObject *o, pts_npts_contours *dst, con
return
1
;
}
struct
cvarrseq
{
class
cvarrseq
{
public
:
union
{
CvSeq
*
seq
;
CvArr
*
mat
;
};
int
freemat
;
cvarrseq
()
{
freemat
=
false
;
}
~
cvarrseq
()
{
if
(
freemat
)
{
cvReleaseMat
((
CvMat
**
)
&
mat
);
}
}
};
static
int
is_convertible_to_mat
(
PyObject
*
o
)
...
...
@@ -1782,6 +1792,7 @@ static int convert_to_cvarrseq(PyObject *o, cvarrseq *dst, const char *name = "n
}
assert
(
size
!=
-
1
);
CvMat
*
mt
=
cvCreateMat
((
int
)
PySequence_Fast_GET_SIZE
(
fi
),
1
,
CV_32SC
(
size
));
dst
->
freemat
=
true
;
// dealloc this mat when done
for
(
Py_ssize_t
i
=
0
;
i
<
PySequence_Fast_GET_SIZE
(
fi
);
i
++
)
{
PyObject
*
e
=
PySequence_Fast_GET_ITEM
(
fi
,
i
);
PyObject
*
fe
=
PySequence_Fast
(
e
,
name
);
...
...
tests/python/leak4.py
0 → 100644
View file @
3a53d866
import
cv
import
math
import
time
N
=
50000
print
"leak4"
while
True
:
seq
=
list
((
i
*
1.
,
i
*
1.
)
for
i
in
range
(
N
))
cv
.
Moments
(
seq
)
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