Dec-29-2017, 07:36 PM
Hi nilamo,
Yes, I understand that for efficiency. But the system running dynamically, some time the queue could be really long an occupy 20 GB and shrink to 200M.
For efficiency I want to reserve some space for queue say 5 GB. But use the whole 20G for reserve is... Well, too much.
Same thing in C++ stl vector. Double the memory when the capacity is full and reduce to half if the (size / capacity == 0.25). I expect the dynamic data structure will have this feature.
Is there any way I could do that? Or the queue is designed by this way?
Yes, I understand that for efficiency. But the system running dynamically, some time the queue could be really long an occupy 20 GB and shrink to 200M.
For efficiency I want to reserve some space for queue say 5 GB. But use the whole 20G for reserve is... Well, too much.
Same thing in C++ stl vector. Double the memory when the capacity is full and reduce to half if the (size / capacity == 0.25). I expect the dynamic data structure will have this feature.
Is there any way I could do that? Or the queue is designed by this way?
(Dec-29-2017, 07:20 PM)nilamo Wrote: Is it supposed to? I haven't looked into it, but maybe Queue holds onto whatever memory it uses, assuming that it'll need it again for future queued objects...