Skip to content

Memory growth when grpc-web streaming #511

Open
@gawmanarnar

Description

@gawmanarnar

I currently have an application that streams frames over grpc to flutter mobile and web clients. When running in mobile, the memory seems stable but when doing it in web it appears the data coming from GRPC never gets garbage collected and memory just continues to grow (until the browser runs out of memory). The entirety of these messages are GC'd when the stream is closed but I need to keep the stream open (live video). Is there a way to release these messages as they are processed? I'm wondering if I'm missing something simple. I know grpc-web is done over http but surely this is possible?

Note: the code I wrote is basically the same between platforms and it uses the GrpcOrGrpcWebClientChannel.

Version information:
url: "https://github.com/grpc/grpc-dart.git"
ref: f23070e
version: "3.0.1-dev"

Repro steps

  1. Have a GRPC server capable of streaming data to a client
  2. Create a GrpcOrGrpcWebClientChannel (running on web)
  3. Call getStream on it
  4. Add a listener to process data

Expected result: Data is garbage collected after being processed

Actual result: Data sticks around and causes memory to grow until out of memory.

Details

Memory from Mobile (looks reasonable)
image

Memory from Web (constantly increasing)
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions