Skip to content

High memory allocation when using longer AckTimeout #288

@adrianotr

Description

@adrianotr

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.

Screenshot 2024-12-17 at 5 09 57 PM

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions