Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.video
Commits
fca6f02d
Commit
fca6f02d
authored
Oct 19, 2018
by
Amir MOHAMMADI
Browse files
Add a test for memory leak in
#12
parent
03973106
Pipeline
#24445
passed with stage
in 15 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/io/video/test.py
View file @
fca6f02d
...
...
@@ -92,6 +92,33 @@ def test_video_reader_attributes():
assert
isinstance
(
iv
.
info
,
str
)
def
test_memory_leak
():
import
psutil
import
tempfile
import
gc
from
.
import
reader
from
bob.io.base
import
save
my_video
=
numpy
.
random
.
random_integers
(
0
,
255
,
(
10
,
3
,
256
*
4
,
256
*
4
))
with
tempfile
.
NamedTemporaryFile
(
suffix
=
'.avi'
)
as
f
:
save
(
my_video
.
astype
(
'uint8'
),
f
.
name
)
del
my_video
gc
.
collect
()
for
i
in
range
(
20
):
vd
=
reader
(
f
.
name
)
for
frame
in
vd
:
pass
del
frame
del
vd
gc
.
collect
()
if
i
==
0
:
first
=
psutil
.
virtual_memory
().
used
last
=
psutil
.
virtual_memory
().
used
assert
(
last
-
first
)
/
first
<
0.003
,
"Looks like we have a memory leak!"
def
write_unicode_temp_file
():
prefix
=
'bobtest_straße_'
...
...
conda/meta.yaml
View file @
fca6f02d
...
...
@@ -58,6 +58,7 @@ test:
-
coverage
-
sphinx
-
sphinx_rtd_theme
-
psutil
about
:
home
:
https://www.idiap.ch/software/bob/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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