This invention discloses a method,
system, device, storage medium, and program product for expanding the capacity of a fixed-length counting array based on address translation to prevent overflow. The method includes the following steps: Step 1: Determine the
data type and length of the array counting, and allocate contiguous memory; Step 2: Check if the highest column of the array counting has overflowed. If not, increment the count; if overflowed, jump to Step 3; Step 3: Check the non-highest bit. If the lower 15 bits of the address are not all zeros, jump to Step 4; if they are all zeros, jump to Step 5; Step 4: Calculate the new address position based on the offset of the lower 15 bits, and jump to Step 6; Step 5: Allocate a new
memory block,
record the offset between the new and old addresses in the lower 15 bits of the original address, and jump to Step 6; Step 6: Increment the uint32 type count of the new address by 1, check if the highest bit is 1. If the highest bit is 1, overflow occurs again, and steps 5 to 6 are repeated. This invention provides an address translation-based scheme that can continue to collect counts and avoid
copying existing memory, thus avoiding memory waste, and providing efficient statistical and query performance.