The present invention is related to a method and apparatus for managing memory
in a network switch, wherein the memory includes the steps of providing a memory,
wherein the memory includes a plurality of memory locations configured to store
data therein and providing a memory address pool having a plurality of available
memory addresses arranged therein, wherein each of the plurality of memory addresses
corresponds to a specific memory location. The method further includes the steps
of providing a memory address pointer, wherein the memory address pointer indicates
a next available memory address in the memory address pool, and reading available
memory addresses from the memory address pool using a last in first out operation.
The method also includes writing released memory addresses into the memory address
pool, adjusting a position of the memory address pointer upon a read or a write
operation from the memory address pool.