It is similar with .NET, try the following code:

Console.WriteLine("Press any key to allocate 100MB");
Console.ReadKey();
var bytes = new byte[100_000_000];

// At this point Linux reports ~6MB of memory used by the process.
Console.WriteLine("Array allocated, press any key to fill with 1s");
Console.ReadKey();
bytes.AsSpan().Fill(1);

// And now we see ~106MB of memory used by the process.
Console.WriteLine("Array filled, press any key to exit");
Console.ReadKey();

On Mon, Jul 10, 2023 at 9:17 AM Raymond Wilson <raymond_wil...@trimble.com>
wrote:

> Hi Pavel,
>
> I want to say this should be included in the ‘used’ memory for a process,
> but perhaps that is not correct.
>
> Raymond.
>
> On Mon, 10 Jul 2023 at 5:07 PM, Pavel Tupitsyn <ptupit...@apache.org>
> wrote:
>
>> Hi Raymond,
>>
>> "allocated=94407MB" reported by Ignite is "committed" memory - requested
>> from the OS, but not entirely used/touched.
>>
>>
>> See
>> -
>> https://github.com/apache/ignite/blob/df685afb08e3c2297adb8fc6df435a7310e95e50/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java#L2369
>> -
>> https://serverfault.com/questions/1008584/committed-allocated-memory-in-linux-is-less-than-used-memory-how-is-that-possib
>> -
>> https://unix.stackexchange.com/questions/137773/is-inactive-memory-related-to-the-commited-but-unused
>>
>> On Sat, Jul 8, 2023 at 11:44 AM Raymond Wilson <
>> raymond_wil...@trimble.com> wrote:
>>
>>> Hi,
>>>
>>> We have an Ignite node reporting off-heap data region allocation like
>>> this in the logs:
>>>
>>>     ^-- Off-heap memory [used=37077MB, free=60.81%, allocated=94407MB]
>>>
>>> The same process (.Net 7 running in a Kubernetes pod with 124Gb
>>> allocated out of 128Gb available on the node), reports this level of
>>> managed memory usage:
>>>
>>> Heartbeat: Total managed memory use: 43836.083Mb
>>>
>>> Clearly ~94Gb + ~44Gb (138Gb) is a lot more than both 128Gb and 124Gb
>>>
>>> The node in question has the initial and maximum allocation for the data
>>> region as 94208Mb (plus the system data region etc), so I expect the Ignite
>>> node to have allocated that much (which is indicated by the 94407Mb
>>> allocated figure noted in the log line.
>>>
>>> However, the .Net CLR is reporting nearly 48Gb of managed RAM usage in
>>> .Net, so something does not add up. Either .Net is lying about how much it
>>> is using, or Ignite is lying about how much RAM it actually allocated.
>>>
>>> I feel I am missing something here!
>>>
>>> Thanks,
>>> Raymond.
>>>
>>> --
>>> <http://www.trimble.com/>
>>> Raymond Wilson
>>> Trimble Distinguished Engineer, Civil Construction Software (CCS)
>>> 11 Birmingham Drive |
>>> <https://www.google.com/maps/search/11+Birmingham+Drive%C2%A0%7C%C2%A0+Christchurch,+New+Zealand?entry=gmail&source=g>Christchurch,
>>> New Zealand
>>> <https://www.google.com/maps/search/11+Birmingham+Drive%C2%A0%7C%C2%A0+Christchurch,+New+Zealand?entry=gmail&source=g>
>>> raymond_wil...@trimble.com
>>>
>>>
>>> <https://worksos.trimble.com/?utm_source=Trimble&utm_medium=emailsign&utm_campaign=Launch>
>>>
>> --
> <http://www.trimble.com/>
> Raymond Wilson
> Trimble Distinguished Engineer, Civil Construction Software (CCS)
> 11 Birmingham Drive | Christchurch, New Zealand
> raymond_wil...@trimble.com
>
>
> <https://worksos.trimble.com/?utm_source=Trimble&utm_medium=emailsign&utm_campaign=Launch>
>

Reply via email to