-
Notifications
You must be signed in to change notification settings - Fork 0
memory cost too high #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @Nyx2022! Some questions:
Regarding your question:
Do you mean how to control the memory cost of an item which requires very little memory? If that's so, remember that AdaptivePool is meant to preallocate statistically when you do not have better information. That is, if most of the time you need to allocate for a certain size range, but in a very specific case you know you will need to allocate less than that, then in the latter case you should either use a different AdaptivePool for that case, or handle allocations differently. Example:
In the example above, the recommendation would be to use one AdaptivePool for each endpoint. That is because the distribution of the memory cost is uneven among both endpoints, and you will benefit from treating them separately. Please, let me know if this helped, I'm thinking of adding some debugging operations, and I would be glad to hear your thoughts. Kind regards. |
|
Question just in case: are you calling
Were the results with 512 worse? Regarding the meaning of the parameters: Have you read the docs describing them? If the meaning of any parameter is unclear in the docs, please, let me know what could be confusing so I can improve them.
Can you explain what is the gopprof flamegraph displaying then? Note that it is understandable that allocations are made if the pool is empty, e.g., if you just started the program and requesting a lot of memory. The goal of the library is to reuse some of those allocations and also allocate more efficiently, not to remove allocations. If your program does require a high number of allocations but doesn't release them with |
i will call put func after i do not use it, |
hi ,i'm using this lib now,but i found when i call get and put very flunetnly,the memery still will increase to a high value for my application

you see, the relative is too high
my config is :
var BufferPool1 = adaptivepool.New( //还不太会用
adaptivepool.BytesBufferProvider{},
adaptivepool.NormalEstimator{
Threshold: 2, // reuse buffer if its Cap is in Mean ± 2 * StdDev
MinCost: 51200, // minimum cost (bytes) of newly created items
},
50, // bias towards the latest 500 elements to increase adaptability
)
can you tell how can i control the memory cost in a little value, thank you inadvance
The text was updated successfully, but these errors were encountered: