Reclaiming Space

trimcore/0 reclaims space in all of Prolog's data areas. At any given time, each data area contains some free space. For example, the local stack space contains the local stack and some free space for that stack to grow into. The data area is automatically expanded when it runs out of free space, and it remains expanded until trimcore/0 is called, even though the stack may have shrunk considerably in the meantime. The effect of trimcore/0 is to reduce the free space in all the data areas as much as possible, and to give the space no longer needed back to the operating system. trimcore/0 is called each time Prolog returns to the top level or the top of a break level.