File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ static PyMethodDef istr_methods[] = {
6767void istr_dealloc (istrobject * self )
6868{
6969 Py_XDECREF (self -> canonical );
70+ PyUnicode_Type .tp_dealloc ((PyObject * )self );
7071}
7172
7273static PyObject *
Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ tox==2.7.0
99sphinxcontrib-newsfeed==0.1.4
1010pytest-cov==2.5.1
1111pygments==2.2.0
12+ psutil==5.2.2
1213-e .
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ pytest-sugar==0.8.0
44ipython == 6.1.0
55pyenchant == 1.6.8
66sphinxcontrib-spelling == 2.3.0
7+ psutil == 5.2.2
Original file line number Diff line number Diff line change 11from multidict ._multidict import istr
22from multidict ._multidict_py import istr as _istr
3+ import gc
4+ import psutil
35
46
57class IStrMixin :
@@ -52,6 +54,24 @@ def xtest_eq(self):
5254class TestPyIStr (IStrMixin ):
5355 cls = _istr
5456
57+ @staticmethod
58+ def _create_strs ():
59+ _istr ('foobarbaz' )
60+ istr2 = _istr ()
61+ _istr (istr2 )
62+
63+ def test_leak (self ):
64+ gc .collect ()
65+ p = psutil .Process ()
66+ info = p .memory_info ()
67+ for _ in range (10000 ):
68+ self ._create_strs ()
69+
70+ gc .collect ()
71+ info2 = p .memory_info ()
72+ rss_diff = info2 .rss - info .rss
73+ assert rss_diff == 0
74+
5575
5676class TestIStr (IStrMixin ):
5777 cls = istr
You can’t perform that action at this time.
0 commit comments