Opened 13 years ago

Closed 13 years ago

#29547 closed enhancement (fixed)

enblend build uses extraordinary amounts of memory

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: hvdwolf@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: haspatch Cc:
Port: enblend

Description

System specifications:

  • MacBookPro3,1
  • 2.2-GHz Core 2 Duo
  • 6 GB RAM
  • Mac OS X 10.6.7

Building the enblend port with the default 2 parallel make jobs slows my computer to a crawl and makes it unresponsive for minutes at a time. The problem is not high CPU usage; high CPU usage does not usually slow down my machine, and in fact CPU usage is low during the problem. The problem is that the build sucks up so much memory that thrashing occurs. I end up having to cancel the build (once I can briefly regain control of the machine) and restart it with fewer jobs, i.e.:

sudo port install enblend build.jobs=1

MacPorts parallel building code computes how many jobs to start based on the number of processor cores, or the number of GB of installed memory, whichever is less; on my 2-core Mac with 6 GB memory, that means 2 jobs get started. But while the MacPorts estimate of 1 GB per job was meant to be overly conservative, enblend's build can make each compile job take up to 2 GB of real memory (as observed in Activity Monitor).

A simple solution would be to disable parallel building entirely for enblend by adding the line:

use_parallel_build no

enblend does take a while to build, and allowing parallel builds on machines that have enough memory to support it would be nice, so a more complicated solution could be to have the portfile set build.jobs to a new computed number based on number of cores and amount of RAM, using a different formula than MacPorts base. For example, instead of 1 job per 1 GB installed RAM it could be 1 job per 4 GB installed RAM. Code to implement this might be adapted from that in MacPorts base. Or perhaps instead of basing the calculation on installed RAM it could be based on free RAM; if that value is ascertainable.

I see that the portfile for hugin-app, which uses enblend, also turns off parallel building, though I'm not sure if this is for the same reason. I see that hugin-app uses a lot of memory to build too, but not as much as enblend (< 1 GB per compile job).

Yes, my 6-GB Mac might be able to sustain the 2-job enblend parallel build if nothing else were running, but that's not likely to be the case: I don't have 6 GB RAM installed to keep it empty; I have it installed because I run programs that use it.

Attachments (1)

Portfile.enblend.diff (458 bytes) - added by hvdwolf@… 13 years ago.
Updated patch with increase of revision number

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by hvdwolf@…

Attachment: Portfile.enblend.diff added

Updated patch with increase of revision number

comment:1 Changed 13 years ago by hvdwolf@…

I was told yesterday in another thread that the revision number is set to 0 on an update/upgrade and only raised on a change. So I adapted this enblend patch to update the revision number as well.

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

There is no reason to increase the port revision because my proposed change does not in any way alter what files will get installed by the port.

comment:3 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.