Battery consumption

Has anyone noted any issues with Xojo, maybe during building or debugging, where it’s causing an inordinate amount of battery consumption?

Building uses 8 cores at 100% during the compile, so you should definitely expect higher battery usage.

Depends on your system, windows x86-64 and macbook pro x86-64 are definately eating battery with xojo, while a macbook pro m1 is actually usable 16+ hours (even when using xojo with compilations etc.).

I was suspecting this.
My laptop is not doing well on battery, and I’ve narrowed it down to a software issue.
However I’ve tested and I don’t believe Xojo is the culprit.

This is good to know, however.
Thanks, Greg.

If you gotta a MacBook Pro, upgrade to Monterey and take advantage of Low Power Mode. Check to make sure your MacBook Pro supports it first.

“Sudo pmset -b gpuswitch 0” will kill the dedicated GPU on bettery.

I always run my macs with Activity with the Dock Icon set to Show CPU History:

it’s a great way to keep an eye on CPU hogs.

If you see something amiss, open activity monitor and sort processes by CPU (make sure you choose View / All Processes first)

It’s actually a MacBook Air. I used to be able to get an unreasonable amount of time, using Xojo too, but recently it just takes a dive. This can’t be an age thing, it’s 6 months old.

I can believe it, a 2020 16" MacBook Pro with only 55 cycles is already on 86% battery health.

Big Sur is terrible for battery life, when I upgraded to BS I original lost 2 hours over Catalina, and it degraded even more over time. Supposedly in Monterey Apple fixed some bugs (WindowServer, looking at you) and with the addition of Low Power Mode (doesn’t work on all models) and disabling the discrete GPU, I was able to get 10 hours again.

I also should add, that the first 16" MacBook Pro never reached 4 hours of battery life, I suspect that this was due to Migration Assistant screwing something up (it screwed up a LOT of things).
With the second one, it still didn’t reach 10 hours until I disabled the dedicated GPU. The bug which affected the 2016 MacBook Pros was either never completely fixed or it came back, where the dGPU would activate for no apparent reason and stay activated.

Mind you on a MBA, there is no dedicated GPU. I would recommend iStat Menus to get an overview of your system info. Just avoid the setapp version, as you’ll be locked into a subscription.

How much performance are you losing by trying to increase battery life?

Apple had me log into a fresh account and just let it run, staying awake. It lost 1% in an hour. Back to my real account, without anything significant running and it lost about 8% during a half an hour call with Apple.

Not a significant amount enough to make me regret it. But I guess YMMV.

Oh… I guess at least you have something to look into now, albeit I wish you luck in narrowing it down.

Thanks. If I find anything the group could benefit from, I’ll post back.
For now all I would have to share is swear words.

1 Like

Welcome to the club of Apple PJ macOS developers.

That’s good, in that it’s a bad enough problem it should be easy to debug:

  • in your account, open Activity
  • from the View menu, choose All Processes
  • the window, sort by %CPU column and watch

Report back anything that is using more than a few% of CPU for any lengh of time.

WIndowServer tends to run hot. What’s that about, and why is it suddenly worse?

I suggest rebooting your machine. On my machine I find that WindowServer starts out between 5% and 8% CPU just after a reboot and gradually makes its way up to 35-40% over about a week. The CPU time seems to correlate to the amount of memory it uses which in my case starts out at ~340MB and works its way up to 12-15GB until I get fed up and reboot.

FWIW, WindowServer manages all of your open windows. I suspect that when apps crash, their opened windows don’t get properly freed in WindowServer.

WindowServer was horrible with Big Sur on this Intel Mac. Some times it consumed an entire core, I am pretty sure that a big reason as to why battery life wasn’t so good with Big Sur.

Its CPU usage has been pretty good so for under Monterey, to the point where the MacBook runs at 10˙c cooler when plugged into the Thunderbolt Display. However memory usage is steadily rising.

I so miss the days of 10.4 ~ 10.9 where the machines worked for months without having to reboot them.

By contrast, one of the Mac Pros that we use for building the IDE is running macOS 10.13, has been up for at least 3 weeks and WindowServer is using 1.2% of the CPU and 285MB of RAM.


I noticed the lights on my external HS are nearly always ON since some years (probably before El Capitan).

They previously were OFF most of the time.

I do not know what they are doing.

And this am i lost 51% of the battery over 90 minutes. According to the activity monitor Spotlight is using 80% of the CPU.

It’s not Xojo causing the issue!

1 Like

Next step, look for crashes in the spotlight processes. In the past there have been spotlight files (or spotlight plugins) which caused crashes. Wasn’t there a bad Xojo spotlight importer at one point?

To look for crashes:

  • Open Console,app
  • from the View menu choose Show Sources (or Show Sidebar)
  • Check for Crash reports or Spin reports:


If you see reports, you may be able to figure out what process is crashing, and if you are really luck, if it’s crashing while indexing a particular file

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.