Gateway memory usage in task manager vs [System]Gateway/Performance/Memory Usage

Hello,
When I check Gateway memory usage in task manager and compare it to [System]Gateway/Performance/Memory Usage(gateway status page), always there is a difference between these two values.
Why there is the difference here?

The memory shown in Ignition is Java’s heap. That is, all of the java objects themselves. That won’t include the memory occupied by the JVM native code, nor the JVM’s own internal structures, nor memory allocated by add-on native interfaces (JNI).

2 Likes

Is it possible to get sum of those value in Ignition by Python?
VM native code + the JVM’s own internal structures + nor memory allocated by add-on native interfaces (JNI)

Not sure. Probably via java.lang.management:

https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/package-summary.html

1 Like

Can you think of any reasons why on a very large Ignition gateway, there might be a very large discrepancy between these numbers?

I think the discrepancy is non-heap memory used by the JVM. The memory usage you’re looking at and configuring in ignition.conf is only heap memory.

This article explains it a bit: Memory footprint of the JVM

2 Likes

What discrepancy? Java has a heap size of 22 GB and is occupying 25½ GB overall. Perfectly normal.

Keep in mind that how much of java’s heap is in use within java is opaque to the OS–it is all “in use”.

3 Likes

Thanks Phil, that last bit really made things click for me.

On my nearly-identical gateway I have the following stats, implying that for this case, the JVM non-heap portion is only using about 600MB as opposed to 3.5 GB in my above post. Is there a kind of “garbage-collection” that is meant to occur on the non-heap portions of Java’s memory? If so, is there any way to interface with this functionality using Ignition?

No, Java GC only applies to the heap. Non-heap usage is entirely controlled by the native subsystem (or JNI add-on) that allocated it. I’m not familiar with tools that would let you explore non-heap allocations. (But I’m not the expert for that.)

1 Like

Hmmm. Actually, I wonder if valgrind would work with the JVM…