Managing Transient Cache Space
All transient objects, whether shared or non-shared, are stored in the transient cache.
The shared transient objects in cache are accessible by all JADE processes. However, the non-shared transient objects can be accessed only by the processes that created them.
-
When a process needs to place an object in the transient cache and the cache is full, objects must be swapped out of the cache to make room.
If the process currently has the most amount of cache allocated to it, it swaps out its own objects. If not, one of the other processes is requested to swap out its objects. Because there may be a delay before this process swaps out its objects, the cache is temporarily expanded to allow the new object to be placed into it.
The process that has been requested to swap out objects does so when it next attempts to allocate cache space or it has been detected as idle (that is, there have been no cache allocations for between 10 and 20 seconds). When temporarily expanded, the maximum that the cache is allowed to exceed the specified size is by 50 percent. If the excess would be more than that, exception 1018 (No memory for buffers) is raised.
-
Inactive processes are activated by sending them a specific Windows message.
This has an important consequence for users who have external C++ threads using the JADE Object Manager or C-level Application Programming Interface (API). If these threads have objects in the transient cache and are likely to be idle for extended periods, it is important that the thread logic includes a Windows message loop so that it can respond to the message sent by the kernel cache housekeeping thread.
The message type is WM_THREAD_CALLBACK. The first parameter is the handle of the method to be called and the second is a parameter to be passed to the method. (Note that external C++ threads already require a Windows message loop if they are to correctly respond to JADE notifications and timer events.)
Without a Windows message loop, the transient cache may remain in excess of its specified maximum memory size until the thread next attempts to insert a transient object into the cache.