You can use flowitem recycling to speed up a model. Flowitem recycling uses more memory in order to store flowitem objects instead of destroying and recreating them. This helps increase the speed of a model run.
Conversely, a model may have too many flowitems and run out of memory. For this case, you could do the opposite of flowitem recycling: destroy flowitems when they are in queue and recreate them when they need to move downstream. This could be helpful if you have queues with so many flowitems that you run out of memory on your system.
Attached is an example model that has "virtual" content on a queue. OnEntry of the queue, it sends a delayed message in 0 time to check if the item is still in the queue. If it is, then it destroys that item and increments a label. When the downstream object (a processor in this model) becomes available, it sends a message to the queue to turn a virtual item back into a real item.
The itemtype and labels on the items are not preserved in this sample. If you want to preserve that data, you would need to store it somewhere else. This isn't a silver bullet for all memory problems, but it might give you an idea on how to minimize memory usage if you have queues with high content.
For fun, this model also custom draw code to draw a stack of boxes in the queue for its virtual content. Also, text visual tools are shown to display the actual number of flowitems in the model and the virtual queue content.
The Following User Says Thank You to Phil BoBo For This Useful Post: