Add getProcessMemory function
Solves #1563
Adds getProcessMemory()
This function returns the current memory usage of gta_sa.exe process. Essentially copied from CMemStats.cpp (win api call) Returned value in KB is equal to the one displayed in memory stats ("showmemstat" command)
It will be useful for big servers that push memory boundaries to the limit (about 3.3 GB) to avoid crashing the client. It's not a secret that when you disconnect from one server and connect to another the current memory usage increases and increases (i personally saw values up to 1.6 GB usage after disconnect). So if you add let's say 1 GB of models to this and some other things the usage will get dangerously close to the limit right after the loading.
This function should allow servers to determine if current memory usage is not too high for their resources. And in this case server could use alternative (more optimized) loading mode or notify the user and ask to restart MTA. Also it could be used to monitor the memory during gameplay and notify the user if it's getting too high (so user could restart MTA before it unexpectedly crashes in a bad moment).
maybe it's better to add it to dxGetStatus?
maybe it's better to add it to dxGetStatus?
Maybe. I thought about this function in the first place since it has TotalPhysicalMemory now. But didn't feel good to use this win api call in dxGetStatus. I guess we need more feedback about this.
Add support for returning in bytes, that should be good.
what is the progress of this?
Superseded by commit dd571b4793ac6773c634a1cdc6b28bfa00891127