Exemple #1
0
        public void SimpleTestMemory()
        {
            bool oldState = Finalizer.Instance.Enable;

            try
            {
                using (PyModule gcModule = PyModule.Import("gc"))
                    using (PyObject pyCollect = gcModule.GetAttr("collect"))
                    {
                        long span1 = CompareWithFinalizerOn(pyCollect, false);
                        long span2 = CompareWithFinalizerOn(pyCollect, true);
                        Assert.Less(span2, span1);
                    }
            }
            finally
            {
                Finalizer.Instance.Enable = oldState;
            }
        }