jonls / redshift

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.
http://jonls.dk/redshift
GNU General Public License v3.0
5.87k stars 424 forks source link

redshift-gtk memory consumption? #112

Closed saamalik closed 9 years ago

saamalik commented 10 years ago

Memory consumption:

15 MiB seems a little excessive for a tiny panel widget, but is this expected? If so, please junk this bug.

Running:

maandree commented 10 years ago

I observe 13,8 MB. Python itself takes 3,4 MB. How much does small graphical programs like this usually take?

maandree commented 10 years ago

I have looked at a few python-based programs and whilst it is quite a bit, it is not that much more that other programs.

ghost commented 9 years ago

I'm not so sure about this, on my box I'm using;

87.14 Mb python3 /usr/bin/redshift-gtk

maandree commented 9 years ago

How long do you have to run /usr/bin/redshift-gtk before it comes to this size?

ghost commented 9 years ago

These are my specs;

Slackware 14.1 x86_64
redshift 1.9.1
python3-3.4.1

I rebooted to test this, as soon as I logged into Openbox, which is just with startx, I ran this command to check the MB of each process;

ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'

And this is the output;

85.63 Mb python3 /usr/bin/redshift-gtk

So to answer the question, redshift runs in the upper 80MB as soon as it starts for me, which seems a little on the heavy side, hmm

maandree commented 9 years ago

Yeah. I have no clue what could be that cause.

saamalik commented 9 years ago

After three days of running, redshift-gtk memory consumption is up to 24.5mb. Looks like there is a slight memory leak as well.

maandree commented 9 years ago

There might be a memory leak in a library redshift-gtk uses, at least I see that as more likely than redshift-gtk itself (although that is still a possibility).

ghost commented 9 years ago

@saamalik looks like I have a bigger memory leak, hehe

maandree, ok...

Well hopefully this is something Jon can look into and fix...

manhtukhang commented 9 years ago

OMG! 298.65 Mb python3 /usr/local/bin/redshift-gtk 0.40 Mb /usr/local/bin/redshift -v

maandree commented 9 years ago

redshift-gtk uses Ubuntu's AppIndicator if available and otherwise traditional xembed. Perhaps it is specific to one of them. What are you guys using?

ghost commented 9 years ago

298 damm ouch! :(

Well as I mentioned I'm using Slack...

jonls commented 9 years ago

Currently we are keeping every output line from the redshift process buffered in redshift-gtk which is probably a bad idea. I can't see any reason why we would want to do this so I'm going to guess that this was probably added for debugging and was just never removed. This should be a quick fix removing those 2-3 lines and will most likely lower the memory use when redshift-gtk is run for weeks. (Note that this is not a memory leak in the technical sense.)

Regarding the memory usage at startup, the numbers that you report seem completely reasonable. However, it should be noted that there are a number of ways of measuring memory usage and without specifying how it is measured or at which tool was used to measure memory usage, the number is not very useful. See this article (http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html) for a good overview and also an answer to why very simple GUI programs can seem to take up a lot of memory.

ghost commented 9 years ago

Ahhh nice to hear, look forward to this quick fix... :)

Thanks jonls

ghost commented 9 years ago

If we clone from git the latest version to get this fix, is the git version just as stalbe as 1.9.1 right now?

Thanks

maandree commented 9 years ago

@moulei Yes. The git version is stable.

ghost commented 9 years ago

thanks

ghost commented 9 years ago

Oh darn, it didn't make a difference on my box;

86.51 Mb python3 /usr/bin/redshift-gtk

I was hoping this was going to be now around 20Mb on my box... :(

Hmm jonls said; lower the memory use when redshift-gtk is run for weeks

Weeks, sheesh I don't know about the rest of everyone, but I'm running this on a laptop that gets shutdown every night.

So what can be done about normal daily usage, in reducing memory usage?

jonls commented 9 years ago

@moulei please go back and read the link I posted in the last post... and then forget about it because it is meaningless.... (you can find a different way of measuring the memory use that will give you 20MiB for redshift-gtk).

ghost commented 9 years ago

Ahh this looks better;

>pmap -d 1981

mapped: 371736K writeable/private: 37428K shared: 112K

So it looks like 37.4MB