4D v13.4Arrays and Memory |
||||||||||||||||||||||||||||
|
4D v13.4
Arrays and Memory
Arrays and Memory
Unlike the data you store on disk using tables and records, an array is always held in memory in its entirety. For example, if all US zip codes were entered in the [Zip Codes] table, it would contain about 100,000 records. In addition, that table would include several fields: the zip code itself and the corresponding city, county, and state. If you select only the zip codes from California, the 4D database engine creates the corresponding selection of records within the [Zip Codes] table, and then loads the records only when they are needed (i.e., when they are displayed or printed). In order words, you work with an ordered series of values (of the same type for each field) that is partially loaded from the disk into the memory by the database engine of 4D. Doing the same thing with arrays would be prohibitive for the following reasons:
Conclusion: Arrays are intended to hold reasonable amounts of data for a short period of time. On the other hand, because arrays are held in memory, they are easy to handle and quick to manipulate. However, in some circumstances, you may need to work with arrays holding hundreds or thousands of elements. The following table lists the formulas used to calculate the amount of memory used for each array type:
Notes:
When working with very large arrays, the best way to handle full memory situations is to surround the creation of the arrays with an ON ERR CALL project method. Example: ` You are going to run a batch operation the whole night The ERROR HANDLING project method is listed here: ` ERROR HANDLING project method |
PROPERTIES
Product: 4D SEE ALSO |
||||||||||||||||||||||||||