4.3. Managing Memory in Swarms

The allocation and deallocation of memory is a necessary feature in any simulation project. Allocating and deallocating memory is one of the most troublesome elements of designing software and Swarm is well equipt to deal with that problem. Swarm provides libraries for this purpose which make the process transparent to user.

In Swarm, objects are created and dropped using a notion of memory zones, and the "dirty work" of allocating memory is handled inside the libraries. In the next sections, we discuss the way objects are created and given a place in memory. When those objects are no longer needed, the program can send that object the drop message, which removes it from memory.