CPC G06F 12/0815 (2013.01) [G06F 2212/1044 (2013.01)] | 14 Claims |
1. A method for managing buffers, comprising:
receiving a plurality of pieces of data, wherein the plurality of pieces of data comprises a first piece of data and a second piece of data;
allocating at least one buffer to establish a cluster buffer according to a data amount of the first piece of data;
storing the first piece of data in the cluster buffer; and
if at least one of a first condition and a second condition is satisfied, ending a storage operation of the cluster buffer, wherein
the first condition is that a total remaining space of the at least one buffer that has stored the data in the cluster buffer is less than a remaining space threshold, and the second condition is that the quantity of the at least one buffer that has stored the data in the cluster buffer reaches a cluster threshold,
before ending the storage operation of the cluster buffer, confirming whether the total remaining space is capable of accommodating the second piece of data, and if yes, storing the second piece of data in the cluster buffer, wherein a priority of the first piece of data and a priority of the second piece of data are the same.
|