Tech Tip: How much memory can 4D use?
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: September 2, 2011
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
- This Tech Tip uses the word "process" in an OS context, not a 4D context. A "process" on both Mac OS X and Windows is typically a single application.
- This Tech Tip uses IEC binary units for memory values. For example a Gigabyte (GB) is a decimal value. It is 10^9 or 1,000,000,000 bytes. A Gibibyte (GiB) on the other hand is a binary value. It is 2^30, or 1,073,741,824 bytes. It is important to use binary ranges because memory addresses are defined as binary numbers (2^32 for 32-bit processors, 2^64 for 64-bit processors).
Before talking about how much memory 4D can use, it is important to know how to actually measure the memory used by 4D.
There are many different memory metrics built in to Mac OS X and Windows. These are the most useful ones:
WindowsTask Manager and/or Resource Monitor and/or Perfmon provide the following metrics:
- Working Set - This is the physical memory (RAM) in use by a process. Because of virtual memory this is obviously not an accurate reflection of the total memory in use.
- Commit Size = total amount of pageable virtual address space for which no backing store is assigned other than the pagefile.
- For 4D it is close to the memory in use but still not quite right.
There are other metrics available in Windows but unfortunately none of them represent the total virtual memory used by 4D.
Mac OS XActivity Monitor (aka top) provides the following metrics:
- Real Memory - a rough count of the number of physical pages that the current process has. In fact this is not important in this context because, again, measuring physical memory does not tell anything about the total virtual memory 4D is using; 4D uses virtual memory, the OS chooses whether or not to use physical memory.
- Virtual Memory - this is exactly the amount of virtual memory used by 4D, though it is rounded when displayed in the GUI.
GET CACHE STATISTICSOn Windows none of the available metrics actually give the used virtual memory for a process. This information is available to a process via Windows API calls but it is not exposed in the reporting tools available. The situation is better on Mac OS X as the Virtual Memory metric is accurate. In fact there is a better way to measure memory used by a 4D application that works on both platforms: use the results of the GET CACHE STATISTICS (GCS) command, in particular the "Used Virtual Memory" value.
Thus the best way to measure the memory used by 4D is to use GET CACHE STATISTICS.
Back to the question, how much virtual memory can 4D use? Here are the answers:
- 32-bit OS - 2 GiB, or 3 GiB with PAE enabled
- 64-bit OS, 32-bit 4D - 4 GiB
- 64-bit OS, 64-bit 4D Server - 8 TB* (Windows only)