Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#54156 closed enhancement (fixed)

port reclaim consumes gigabytes of memory

Reported by: mojca (Mojca Miklavec) Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone: MacPorts 2.4.2
Component: base Version:
Keywords: haspatch Cc: ksammons@…
Port:

Description

During Building list of distfiles still in use the port reclaim consumes gigabytes of memory (well over 4 GB in my case) and takes forever to complete. Even after Ctrl+C it takes about a minute to actually finish.

Could the implementation be slightly more optimised in that respect?

Actually reclaim could even ask to remove all distfiles before counting them. Once the port is installed the user might no longer need it.

(The period should be changed from two weeks to two months. Why would I need to run reclaim every two weeks? In the past I nearly never did it unless I was really really short on disk space.)

Change History (11)

comment:1 Changed 7 years ago by mojca (Mojca Miklavec)

Cc: ksammons@… added

comment:2 Changed 7 years ago by neverpanic (Clemens Lang)

Can you try

  • src/macports1.0/reclaim.tcl

    diff --git a/src/macports1.0/reclaim.tcl b/src/macports1.0/reclaim.tcl
    index 4db3fda3..dcd18a50 100644
    a b namespace eval reclaim { 
    191191                set patchfiles {}
    192192            }
    193193
     194            mportclose $mport
     195
    194196            foreach distfile [concat $distfiles $patchfiles] {
    195197                set root_path [file join $root_dist $dist_subdir $distfile]
    196198                set home_path [file join $home_dist $dist_subdir $distfile]

and see if that helps?

comment:3 Changed 7 years ago by mojca (Mojca Miklavec)

Wonderful, thank you very much. Now the memory consumption only goes from 22 to 24 MB rather than consuming gigabytes. Your patch seems to do the expected magic :).

comment:4 Changed 7 years ago by mojca (Mojca Miklavec)

Keywords: haspatch added

comment:5 Changed 7 years ago by mojca (Mojca Miklavec)

Owner: set to mojca
Resolution: fixed
Status: newclosed

In c2df3cc958635f7ac6d0983288723c6ea097b221/macports-base:

Close the portfiles after reading

Close the files in 'port reclaim'
to prevent excessive use of memory.

Closes: #54156

comment:6 Changed 7 years ago by neverpanic (Clemens Lang)

Milestone: MacPorts Future

comment:7 Changed 6 years ago by neverpanic (Clemens Lang)

Milestone: MacPorts FutureMacPorts 2.5.0

comment:8 Changed 6 years ago by neverpanic (Clemens Lang)

Milestone: MacPorts 2.5.0MacPorts Future

comment:9 Changed 6 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.5.0

comment:10 Changed 6 years ago by mojca (Mojca Miklavec)

Why 2.5.0?

comment:11 Changed 6 years ago by raimue (Rainer Müller)

Milestone: MacPorts 2.5.0MacPorts 2.4.2

This was already released with MacPorts 2.4.2, see [ca215c1500181ce7942476d439780a9a155499e4/macports-base].

(The 2.4.2 milestone did not exist and I just created it.)

Note: See TracTickets for help on using tickets.