Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
5ee4e82a
Commit
5ee4e82a
authored
May 05, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greentest.py: better algorithm for detetecting leaks
parent
e7c974cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
greentest/greentest.py
greentest/greentest.py
+20
-3
No files found.
greentest/greentest.py
View file @
5ee4e82a
...
...
@@ -75,11 +75,28 @@ def wrap_refcount(method):
sys
.
modules
[
'urlparse'
].
clear_cache
()
d
=
gettotalrefcount
()
-
d
deltas
.
append
(
d
)
if
2
<=
len
(
deltas
)
<=
3
and
deltas
[
-
2
:]
==
[
0
,
0
]:
# the following configurations are classified as "no leak"
# [0, 0]
# [x, 0, 0]
# [... a, b, c, d] where a+b+c+d = 0
#
# the following configurations are classified as "leak"
# [... z, z, z] where z > 0
if
deltas
[
-
2
:]
==
[
0
,
0
]
and
len
(
deltas
)
in
(
2
,
3
):
break
if
3
<=
len
(
deltas
)
and
deltas
[
-
3
:]
==
[
0
,
0
,
0
]:
elif
deltas
[
-
3
:]
==
[
0
,
0
,
0
]:
break
if
len
(
deltas
)
>=
6
:
elif
len
(
deltas
)
>=
4
and
sum
(
deltas
[
-
4
:])
==
0
:
break
elif
len
(
deltas
)
>=
3
and
deltas
[
-
1
]
>
0
and
deltas
[
-
1
]
==
deltas
[
-
2
]
and
deltas
[
-
2
]
==
deltas
[
-
3
]:
raise
AssertionError
(
'refcount increased by %r'
%
(
deltas
,
))
# OK, we don't know for sure yet. Let's search for more
if
sum
(
deltas
[
-
3
:])
<=
0
or
sum
(
deltas
[
-
4
:])
<=
0
or
deltas
[
-
4
:].
count
(
0
)
>=
2
:
# this is suspicious, so give a few more runs
limit
=
10
else
:
limit
=
6
if
len
(
deltas
)
>=
limit
:
raise
AssertionError
(
'refcount increased by %r'
%
(
deltas
,
))
finally
:
gc
.
collect
()
...
...
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