<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/GetProcessMemoryStats?action=history&amp;feed=atom</id>
	<title>GetProcessMemoryStats - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/GetProcessMemoryStats?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetProcessMemoryStats&amp;action=history"/>
	<updated>2026-05-09T23:55:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetProcessMemoryStats&amp;diff=75650&amp;oldid=prev</id>
		<title>Botder: Created page with &quot;__NOTOC__ {{Shared function}} {{Added feature/item|1.6.0|1.5.9|21389|This function returns a breakdown of the process memory usage. The reported numbers are always byte units and these numbers can be '''inaccurate'''.}}  ==Syntax==  &lt;syntaxhighlight lang=&quot;lua&quot;&gt; table|nil getProcessMemoryStats ( ) &lt;/syntaxhighlight&gt;   ==Returns== Returns a table if successful, otherwise returns '''nil'''  {| class=&quot;wikitable&quot; style=&quot;cellpadding: 10px;&quot; |- ! Property || Description |- | &lt;c...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetProcessMemoryStats&amp;diff=75650&amp;oldid=prev"/>
		<updated>2022-11-03T14:12:09Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{Shared function}} {{Added feature/item|1.6.0|1.5.9|21389|This function returns a breakdown of the process memory usage. The reported numbers are always byte units and these numbers can be &amp;#039;&amp;#039;&amp;#039;inaccurate&amp;#039;&amp;#039;&amp;#039;.}}  ==Syntax==  &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; table|nil getProcessMemoryStats ( ) &amp;lt;/syntaxhighlight&amp;gt;   ==Returns== Returns a table if successful, otherwise returns &amp;#039;&amp;#039;&amp;#039;nil&amp;#039;&amp;#039;&amp;#039;  {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;cellpadding: 10px;&amp;quot; |- ! Property || Description |- | &amp;lt;c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Shared function}}&lt;br /&gt;
{{Added feature/item|1.6.0|1.5.9|21389|This function returns a breakdown of the process memory usage. The reported numbers are always byte units and these numbers can be '''inaccurate'''.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table|nil getProcessMemoryStats ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns a table if successful, otherwise returns '''nil'''&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;cellpadding: 10px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property || Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;virtual&amp;lt;/code&amp;gt; || total program size&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;resident&amp;lt;/code&amp;gt; || resident set size (memory in physical space/ram, also known as ''working set'')&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;shared&amp;lt;/code&amp;gt; || size of resident shared memory (shared with other processes)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt; || size of resident private memory (only for this process)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Resident set size should be roughly &amp;lt;code&amp;gt;shared&amp;lt;/code&amp;gt; + &amp;lt;code&amp;gt;private&amp;lt;/code&amp;gt; from the table.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will output the memory usage by the server process to the console every 5 minutes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
setTimer(function()&lt;br /&gt;
    local div = 1024^2&lt;br /&gt;
&lt;br /&gt;
    local pmem = getProcessMemoryStats()&lt;br /&gt;
&lt;br /&gt;
    if pmem then&lt;br /&gt;
        outputServerLog((&amp;quot;[SYS] %.2f MiB  rss:%.2f MiB  shr:%.2f MiB  prv:%.2f MiB&amp;quot;):format(&lt;br /&gt;
            pmem.virtual / div,&lt;br /&gt;
            pmem.resident / div,&lt;br /&gt;
            pmem.shared / div,&lt;br /&gt;
            pmem.private / div&lt;br /&gt;
        ))&lt;br /&gt;
    end&lt;br /&gt;
end, 5 * 60000, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Utility functions}}&lt;/div&gt;</summary>
		<author><name>Botder</name></author>
	</entry>
</feed>