Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The test suite spends 20% of it's time in gc.collect() #6705

Closed
Kojoley opened this issue Jul 8, 2016 · 2 comments
Closed

The test suite spends 20% of it's time in gc.collect() #6705

Kojoley opened this issue Jul 8, 2016 · 2 comments
Milestone

Comments

@Kojoley
Copy link
Member

Kojoley commented Jul 8, 2016

Thu Jul 07 14:33:31 2016    matplotlib_cProfile_fulltest.pstat

         192634679 function calls (182051956 primitive calls) in 345.231 seconds

   Ordered by: internal time
   List reduced from 9374 to 3 due to restriction <3>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2986   75.105    0.025   75.107    0.025 {gc.collect}
     1250   19.139    0.015   19.139    0.015 {matplotlib._png.write_png}
     2257    9.801    0.004    9.801    0.004 {matplotlib._png.read_png_int}

Mostly this is due to this call

Python is very memory effective because of reference counting (object is freed when refcount drops to zero even with gc.disable) and gc.collect only forces him to run cyclic garbage collector immediately. If it is not acceptable to to remove this call, can we have option to tuning this?

@tacaswell
Copy link
Member

👍 on removing that line.

That line went in in 42fa2b6 where @mdboom notes it makes debugging memory usage easier. However, I am willing to trade 20% on the tests for inflicting pain on the dev who does memory debugging 😈 .

@Kojoley
Copy link
Member Author

Kojoley commented Jul 8, 2016

We can add turnable plugin for this case.

    class EnforcedGC(Plugin):
        def afterTest(self, test):
            gc.collect()

@QuLogic QuLogic added this to the 2.1 (next point release) milestone Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants