Please enable JavaScript to view this site.

ESL Documentation

Navigation: » No topics above this level «

Q11 How can an ESL application determine how much memory is being used?

Scroll Prev Top Next More

The built-in function “freesize” has traditionally been used to determine when an ESL application is running out of memory, however, due to the dynamic allocation of memory, this pseudo variable value changes as additional memory is allocated and is then used. To obtain an accurate view of the current memory situation you must use the “EslMemStats” routine, which is available via the EslLIB library. This function is declared in the “ESLLIB.INC”, and a subroutine of the same name can be called to record the statistics in the errorlog.If you wish to access the function, here are the details of the structure needed:

FAQ_MemoryManagement_Q11_Sample1

As well as recording this important information in the errorlog, it is recommended that the User of the ESL application be warned when the current pool size is getting close to the maximum pool size. The following routine, uses information returned by the EslMemStats to display a message box to the User when the current pool size exceeds 80% of the maximum pool size and should be call after the squeeze memory has been performed:

FAQ_MemoryManagement_Q11_Sample2

You may wish to amend the percentages at which the messages are display. The Current Pool Size is saved in an application wide variable “MemCurrentSize”, which prevents the User being continually interrupted with the warning message.