-
-
Notifications
You must be signed in to change notification settings - Fork 17.2k
bound option on spsc_queue.rs seems to have no effect #98251
Copy link
Copy link
Open
Labels
A-concurrencyArea: ConcurrencyArea: ConcurrencyC-bugCategory: This is a bug.Category: This is a bug.S-candidate-for-closingStatus: This issue will be closed after a week or so unless objections are raised.Status: This issue will be closed after a week or so unless objections are raised.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-concurrencyArea: ConcurrencyArea: ConcurrencyC-bugCategory: This is a bug.Category: This is a bug.S-candidate-for-closingStatus: This issue will be closed after a week or so unless objections are raised.Status: This issue will be closed after a week or so unless objections are raised.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Hey,
I am using channels on my rust code which behind the scene uses
stream::Packetthat usessync::mpsc::spsc_queue.I notice that my application reaches peaks on the queue size and the memory usage is not dropped after those peaks even though I see that the
boundoption is set to 128 elements:rust/library/std/src/sync/mpsc/stream.rs
Line 70 in fe5b13d
I looked at the
spsc_queue.rscode and I notice that thecached_nodesis not increased when adding an element to the cache:rust/library/std/src/sync/mpsc/spsc_queue.rs
Line 180 in fe5b13d
I tried locally the following change and it fixed the problem:
I am not sure if this is a right fix or whether my analysis is correct (maybe I got it all wrong?). Please let me know what you think or if there is anything else I might be missing?
Thanks.