Skip to contentSkip to conversation

Too much memory consumption by powertop

Powertop Alexandra Yates 1 participant 1 message Apr 29, 2015

lore
Share & tools
lore

Alexandra Yates

author
#0 lore raw
Quoted 74 lines

At Wed, 29 Apr 2015 10:39:37 -0700 (PDT),

Quoted 62 lines · Alexandra Yates
Quoted 20 lines

At Tue, 28 Apr 2015 10:14:17 -0700 (PDT),

Quoted 16 lines · Alexandra Yates
Quoted 16 lines

As powertop list is for subscribers only, here Takashi's findings concerning a big memory waste fowarded:

---------- Forwarded Message ----------

Subject: Too much memory consumption by powertop
Date: Tuesday, April 28, 2015, 05:32:41 PM
From: Takashi Iwai <tiwai(a)suse.de>
To: powertop(a)lists.01.org
CC: trenn(a)suse.de

Hi,

I noticed that powertop consumes way too much memory than needed.

It

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

constantly takes over 170MB RES, sometimes over 200MB.

Then I looked at profile, and it showed that most of memory is allocated for newpad_sp(). Indeed, the current code allocates a

pad

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines

of the fixed size of 1000x1000 (!) for each tab, and we have five tabs, so five times of that. No wonder that such a small neat CUI program is so hungry.

For example, a hack like below already reduces the memory footprint to around 20MB, 90% cut. Not bad.

src/display.cpp +1 -1
@@ -48,7 +48,7 @@ void create_tab(const string &name, cons
        if (!w)
                w = new(class tab_window);
 
-       w->win = newpad(1000,1000);
+       w->win = newpad(80,160); // XXX FIXME XXX
        tab_names.push_back(name);
        tab_windows[name] = w;
        tab_translations[name] = translation;

Can anyone look into this and give a better / smarter solution?

thanks,

Quoted 9 lines
Quoted 9 lines
Quoted 7 lines

Takashi
-----------------------------------------
_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop

To avoid the high memory consumption on testing run it on HTML mode

so

Quoted 2 lines
Quoted 1 line

that the powertop.html report is generated in the background.

Quoted 8 lines
Quoted 5 lines

Yeah, starting firefox is smaller than powertop, indeed :)

Takashi

Now if you really want save resources you could go by having your output on a .txt file.

Quoted 6 lines

Heh, I don't need to save so much memory at all. But consumption of 200MB for this kind of tool with CUI, not GUI, is just bad. One may call it a bug.

Your suggestion is helpful, but it's neither solution nor workaround in this regard.

I agree it is problematic that n-curses is sucking all these memory to
show txt on the command line interface. However, at the moment the only
thing I can provide you is to use the other capabilities of powertop collecting data via html or txt.

It would be awesome if you could take, Arjan's and Auke's feedback and help us spin a patch that addresses this issue.

Quoted 6 lines

thanks,

Takashi

Thank you,
Alexandra.