There seems to be a correlation between the ack timeout and memory allocation. The longer I set it, the more memory gets allocated.
Here you can see the allocations if the timeout is set to 100 days, but the problem is visible for smaller ack timeouts as well.
You can use the program bellow to reproduce the issue:
var client = await new PulsarClientBuilder()
.ServiceUrl("pulsar://localhost:6650")
.BuildAsync();
long memoryBefore = GC.GetTotalMemory(true);
await using var consumer = await client.NewConsumer()
.Topic("test-topic")
.SubscriptionName("test-subscription")
.AckTimeout(TimeSpan.FromDays(100))
.SubscribeAsync();
long memoryAfter = GC.GetTotalMemory(true);
Console.WriteLine($"Memory used: {(memoryAfter - memoryBefore) / 1_000_000} mb");
There seems to be a correlation between the ack timeout and memory allocation. The longer I set it, the more memory gets allocated.
Here you can see the allocations if the timeout is set to 100 days, but the problem is visible for smaller ack timeouts as well.
You can use the program bellow to reproduce the issue: