A system comprising a counter adapted to monitor the memory consumption of
the allocated memory resources. Upon reaching or surpassing the memory
resource threshold provided, the counter may indicate the need for
garbage collection. The garbage collector assesses the memory and
releases memory resources that are consumed by the programs but are not
needed anymore. The recycled memory resources are thus provided to the
programs and the counter is updated accordingly. In addition, the system
may also include instructions requesting memory resources. After
detecting such instructions, the memory usage counter is updated either
by the exact amount of memory allocated or the estimated amount of memory
allocated. The counter may be implemented in hardware or in software.