Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High amount of memory usage from ImmutableList<Int64> #358

Open
novak-dev opened this issue Jun 29, 2023 · 1 comment
Open

High amount of memory usage from ImmutableList<Int64> #358

novak-dev opened this issue Jun 29, 2023 · 1 comment

Comments

@novak-dev
Copy link

novak-dev commented Jun 29, 2023

immutablelist-leak
Describe the bug
After running load tests, I have observed a potential memory leak when running the meta-api descriptor service.

To Reproduce

  1. Run Wamp server realm and run realm.HostMetaApiService()
  2. Create a topic for reflection based publisher/subscriber
  3. Create a large number of clients (1000+) and subscribe to the topic
  4. Disconnect these clients
  5. Repeat the previous two steps a few times, make sure to use new session id for the clients

Expected behavior
When clients disconnect the memory used by the ImmutableList mSubscribers should drop

.NET platform variant

  • .NET 6.0 on Windows 10
  • Wampsharp build 23.5.1 (also reproducible on older versions)

Additional context
See the attached file for info. The count only goes up in ImmutableList> and that memory never gets released, even when I force GC multiple times. Issue goes away when I disable meta api service or I do not perform any subscriptions.

@novak-dev
Copy link
Author

Hi just a quick update - I don't believe it is actually a leak anymore since I logged the number of subscribes in the list and it was not going up.

It must be some kind of quirk with the GC since immutable list is used and its constantly copying the entire list every time a new entry is added. This is probably creating a lot of garbage. So I would suggest to use a regular list instead to avoid it.

@novak-dev novak-dev changed the title SessionId leak in ImmutableList<Int64> High amount of memory usage from ImmutableList<Int64> Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant