Disclosed are, inter alia, methods, apparatus, data structures,
computer-readable media, and mechanisms for maintaining counters, such as
in, but not limited to a packet switching system, and updating a
secondary counter storage based on values of the counters and entries in
an overflow buffer. Multiple counter values are stored in a counter bank.
An indication of a particular counter of the multiple counters to update
is received. A current value of the particular counter is updated in the
counter bank, and if an overflow condition results, then an indication of
the particular counter is added to an overflow buffer. Periodically each
of the multiple counters is visited and corresponding values are updated
in a secondary storage, and each entry is retrieved from the overflow
buffer and a corresponding value is updated in the secondary storage.