Memory usage of SharedImagePool keeps growing
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- stream-processing
Research direction
Start with the composite component shown in the issue, especially the Join call, DeliveryPolicy.LatestMessage settings, and SharedImagePool behavior. Reproduce the case where the primary stream has no data and inspect whether secondary Shared frames remain retained. Done means explaining the retention and identifying a concrete correction or confirming the behavior is expected.
Written by the indexing model from the issue text.
Description
Hello, I am writing a composite component. The memory usage of the shared memory pool grows when a Join operator does not receive data from its primary stream.
The secondary stream of that Join operator is a video stream. I set delivery policies to LatestMessage so nothing should be queued at receivers' queues.
The growth of memory usage stops when a new data frame is available on the primary stream. That means, images on the secondary stream are queued, and the shared image pool is requesting more memory from the operating system.
I do not know why this happens, please help. Here is my code:
public sealed class ActionUnitDetector : Subpipeline, IProducer<IReadOnlyList<IReadOnlyDictionary<int, float>>> {
private readonly Connector<IReadOnlyList<NormalizedLandmarkList>> _inConnector;
private readonly Connector<Shared<Image>> _imageInConnector;
private readonly Connector<IReadOnlyList<IReadOnlyDictionary<int, float>>> _outConnector;
private readonly Connector<IReadOnlyList<Shared<Image>>> _alignedImagesOutConnector;
public Receiver<IReadOnlyList<NormalizedLandmarkList>> DataIn => _inConnector.In;
public Receiver<Shared<Image>> ImageIn => _imageInConnector.In;
public Emitter<IReadOnlyList<IReadOnlyDictionary<int, float>>> Out => _outConnector.Out;
public Emitter<IReadOnlyList<Shared<Image>>> AlignedImagesOut => _alignedImagesOutConnector.Out;
public ActionUnitDetector(Pipeline pipeline) : base(pipeline, nameof(ActionUnitDetector), DeliveryPolicy.LatestMessage) {
_inConnector = CreateInputConnectorFrom<IReadOnlyList<NormalizedLandmarkList>>(pipeline, nameof(DataIn));
_imageInConnector = CreateInputConnectorFrom<Shared<Image>>(pipeline, nameof(ImageIn));
_outConnector = CreateOutputConnectorTo<IReadOnlyList<IReadOnlyDictionary<int, float>>>(pipeline, nameof(Out));
_alignedImagesOutConnector = CreateOutputConnectorTo<IReadOnlyList<Shared<Image>>>(pipeline, nameof(AlignedImagesOut));
var convertedImage = _imageInConnector
.Convert(PixelFormat.RGB_24bpp, DeliveryPolicy.LatestMessage);
var aligner = new FaceImageAligner(this);
_inConnector.Join(
convertedImage,
Reproducible.Exact<Shared<Image>>(),
ValueTuple.Create,
DeliveryPolicy.LatestMessage,
DeliveryPolicy.LatestMessage
)//TODO: shared image pool grows too large when no face is detected! Fuse() does not help; swapping streams does not help. Why?
.PipeTo(aligner, DeliveryPolicy.LatestMessage);
aligner.PipeTo(_alignedImagesOutConnector, DeliveryPolicy.LatestMessage);
var inferenceRunner = new InferenceRunner(this);
aligner.PipeTo(inferenceRunner, DeliveryPolicy.LatestMessage);
inferenceRunner.PipeTo(_outConnector, DeliveryPolicy.LatestMessage);
}
}
Thank you
- Dominant language
- C#
- Stars
- 574
- Forks
- 104
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/psi
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 42/100
-
feature request help wanted
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
help wanted
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·