Memory Use Update: Much Improved

Thatā€™s going to get us off topic really fastā€¦ might want to start a new one

6 Likes

I should have thought of that earlier :slight_smile:

I'll preface this by saying my use has been limited at best, learning it at Uni about 20+ years ago, and only using it very occassionally since.

My very limited understanding of the premise behind the approach is that.... In other languages like C and C++ (which I have never used), as the programmer you needed to manage your use of the memory on the machine you were running on. If you created a variable, you needed to manage cleaning up after yourself in terms of releasing the memory it consumed while you were using it. You also had open access to the memory of the host / device, so you could, through poor practices, impact other applications, if you weren't careful. You also needed to take into consideration the platform you were running on, which sometimes required (I expect) some very different code, particularly between Windows / DOS and Unix / Linux.

With those, and (I presume) other problems (Oracle?) Sun were trying to solve by introducing Java, they basically said, we'll develop a piece of software (the Java Virtual Machine) that is developed specifically for different platforms, allowing you to talk to the JVM in a platform agnostic way for interactions with the OS / GUI, freeing you up as a developer to not have to concern yourself with how to program for Unix vs Windows. The JVM will also operate in a defined "sandbox" of memory that the programs running in the JVM will have access to, and the JVM will periodically do what it refers to as "garbage collection", cleaning up any memory in the sandbox no longer being used.

Now as to the reasons this doesn't always perform the way it should, that may be better explained by those more experienced than me, but I expect there can be some situations where the best intentions on the part of the Java platform, it still needs attention by the developers to ultimately achieve the intended ideal, particularly in the space of memory management.

3 Likes

I'm let me rephrase what's the issue with java on hubitat and can they change the programming language?

Not aware of any issue particular to Hubitat. Providing end users with an embedded scripting environment is always going to be a challenge, whether the underlying execution environment (not language) is JVM, .NET or whatever. The vendor doesn't control what users do with it - they only control what parts of the underlying platform get exposed (HE exposes a lot :pray:).

In theory yes, JVM supports many languages, but to what end? Doesn't change the underlying challenge and introduces a whole lot of new / unnecessary complexity. As @wiegout pointed out, Groovy was picked because that's what HE's target market was using on SmartThings. Makes sense.

Let's try to bring things back on topic. Many here are discussing memory leaks as though they're a fact, but we don't know. What we know is that the heap is growing and it sometimes looks like it grows in an unbounded way and that the hub will eventually run out. That can be misleading. The heap may grow because scripts are in fact referencing more and more objects or aren't actually releasing the resources when done. Or there could be a leak. AFAIK users can't tell.

A garbage collector is a canonical example of a memory/CPU tradeoff : instead of optimising memory usage as you go, you delay it, hopefully to a time where it won't affect overall performance (you want your lights to come on instantly, admit it). Balancing overall time spent in GC, how often & how long GC runs are allowed to last, that is an art... imagine finding a compromise that works regardless of what your users are doing.

5 Likes

Oh, that's cool. Never knew that was a thing. So if I'm looking at that, as a general rule, when should I start to think I have a problem? When I looked at it last night, it was around 64K, but that number had been steadily increasing for a few hours, (working off memory there), Is a bigger number better? or if that number is increasing, does that mean I am im leaking?

My hub won't work right at all (slow response, missed Maker API calls/events, etc) <~150K-200K... So if you are really at 64K, and everything is working, that is pretty cool.

1 Like

Well, I've slept since then and I'm running on memory, haha. I do recall the number Started with 64, but as I skimmed down the list, there were numbers starting with 53. Again off memory, I am assuming the top of the list is the most recent? so as you look down the list you are going back in time? (Yeah I just heard Huey Lewis in my head when I wrote that).

Top of the list is the oldest. Newest is at the bottom. There is a timestamp on the rows, if you forget.

The hub starts logging alerts below 80 MB I believe (you can see them in the location events tab of the logs).

I think you both mean M, not K, right ? :smiley:

oh.. humm, I'll have to look when I get back home...

Quite possible, this is the first time I've even given this any thought.. so I'm essentially clueless, trying to figure it out!

This feels like asking ā€œcan they start over from scratch and release a different home automation hub onto the market?ā€

Iā€™m sure anythingā€™s possible (not a programmer here, either) but why even take the time to consider that possibility?

You seem to be assuming something is definitely fundamentally wrong with the hub.

1 Like

Truer words were never spoken. WAAAAAAAY off topic.

7 Likes

Thank you again for this. As I said I was unaware that this was available. It had been on my to do list to add hub info into hubigraph (like many have done) to get a visual.

My hub memory stays pretty consistent except at the first ~4:10 am after I reboot I see a massive drop of 80mb and then every day following an additional 20mb drop at the same time.

I checked my HPM update check timer ā€¦ yup, this hub is set for 4:05am. I think I am going to disable daily checks.

If you don't need the historical data you can also go here to get memory usage at a given instant. It updates much more frequently then the history URL

http://hubitat-main.local/hub/advanced/freeOSMemory

2 Likes

Super cool and useful info.

10 posts were split to a new topic: [2.3.7.113] Memory [C7]

So you're running just the automation on the C8 , and devices connected to a C7, or everything on the C8?

1 Like

Current status is:

C8:

  • 93 Zigbee devices
  • All automations but one

C7:

  • 39 Zigbee devices
    -- 35 shared back to C8
  • One RL automation - just there by chance, really
  • Bond Fan integration
  • Home Assistant Device Bridge

I used to run two C7s - one that was replaced by my C8, and a second that I'm still using. The second C7 was purchased when I was having some issues on my original C7 w/some Z-Wave blinds. I put the blinds on the second C7 hoping that they would behave more reliably, and they generally did. All the blinds are on my C8 now, w/its external antenna they (and Z-Wave in general) have been perfect.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.