Say a backend process subscribes to channel A. At this point, channel A exists in Redis' memory. Then that process dies, does Redis remove channel A from Redis' memory? Since channel A has no more subscribers.

Reason I ask is, if Redis keep channels that have 0 subscriber (due to subscriber processes die or other reasons), these channels can linger and become junk data. Imagine it's not 1 channel, but millions of stale channels with no subscribers. It could lead to memory leak.

So, does Redis delete channels that have no subscribers? Thanks a lot!

Comment From: enjoy-binbin

when a client is closed, actuall we will call freeClient, and freeClient will unsubscribe all the channel the client subscribed, and if a channel have 0 subscriber (also mean have 0 client), the server will delete the channel.

so the answer is yes, Redis will delete channels that have no subscribers.