Edgewall Software

Ticket #7518 (new task)

Opened 4 months ago

Last modified 6 weeks ago

Cleanup Trac Imports

Reported by: cg@… Owned by:
Priority: high Milestone: 0.13
Component: general Version: 0.12dev
Severity: major Keywords: patch
Cc: cg@…

Description

Since I'm using Trac very much I have a big problem with it. It just leaks memory, a gc.collect() collects more than 10.000 objects after some requests.

I have just created a patch file that cleans up unused imports, star-imports are also deleted ('cause they clutter the namespace). Maybe that's a startingpoint to cleanup some things and let it leak less memory.

Attachments

imports.patch (33.4 KB) - added by cg@… 4 months ago.
The patch file that fixes some import-errors
imports.2.patch (21.4 KB) - added by Christopher Grebs <cg@…> 4 months ago.
New patch (without * imports replaced)

Change History

Changed 4 months ago by cg@…

The patch file that fixes some import-errors

follow-up: ↓ 3   Changed 4 months ago by Christopher Grebs <cg@…>

Oh, by the way. The patch was created with the latest changeset included ([7455])

I'm still not sure if it really helps to minimize memleak but it cleans it up anyway :D

  Changed 4 months ago by Christopher Grebs <cg@…>

  • cc cg@… added

in reply to: ↑ 1   Changed 4 months ago by Christopher Grebs <cg@…>

Replying to Christopher Grebs <cg@…>:

Oh, by the way. The patch was created with the latest changeset included ([7455]) I'm still not sure if it really helps to minimize memleak but it cleans it up anyway :D

argh, wrong link. Anyway the latest trunk (not 0.11 stable branch) is the base.

  Changed 4 months ago by mgood

Thanks for looking at the unused imports. Getting rid of some of those helps keep the code clean, but is not going to have a significant impact on memory usage. Imported modules are always referred to by sys.modules, so they will never get garbage collected (this is intentional to make sure modules are only executed the first time you import them).

However, I think most of the "import *"s are intentional. Trac uses __all__ extensively to ensure that "import *" only imports names intentionally exposed by that module and does not pollute the namespace. This is also convenient for commonly used modules like "trac.core" so that you don't have to remember to add each of these as you start to use them.

Can you re-submit a patch that does not include the "import *" expansions?

Changed 4 months ago by Christopher Grebs <cg@…>

New patch (without * imports replaced)

  Changed 4 months ago by Christopher Grebs <cg@…>

I just added the new patch – this should work... thank's for answer my ticket. Regarding memory-leaking: I learned that python2.4 can't free reserved memory and I think that's the most depressing thingy...

  Changed 6 weeks ago by rblank

  • keywords patch added
  • milestone set to 0.13

Some cleanup would indeed be needed.

Add/Change #7518 (Cleanup Trac Imports)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from (none). Next status will be 'new'
The owner will change from (none) to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.