Tech Tip: How much memory is being used by none DB Cache
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: August 3, 2018
The GET MEMORY STATISTICS command can help us determine how much memory is being used by none cache items by first looking at the amount of used cache and then subtracting that number from the amount of used virtual memory.
Here is a helper method that can be used to find this value:
// UTIL_HowMuchMemIsNotCache // returns the amount of memory used by non-cache items // $0 = C_REAL C_REAL($0) ARRAY TEXT($arrNames;0) ARRAY REAL($arrValues;0) ARRAY REAL($arrCount;0) GET MEMORY STATISTICS(1;$arrNames;$arrValues;$arrCount) If (Size of array($arrValues)>=8) $0:=$arrValues{6}-$arrValues{2} // used virtual memory - used cache = total used memory by things other than db cache End if |
If the code above is saved as a project method named UTIL_HowMuchMemIsNotCache then it could be used like this:
ALERT(String(UTIL_HowMuchMemIsNotCache ;"###,###,###,##0")) |