WampSharp
WampSharp copied to clipboard
Memory usages
Hi, Can you please let me know what to do in this case?
Whenever you perform a publication, a RawMessage
object is created. It contains the JSON of the corresponding EVENT message and this value is sent to all subscribers of the topic. The idea is that this JSON value is computed once for all of the topic subscribers.
The fact that you have so many instances of this type indicates that you have a lot of publications going on in your router. I don't know if anything can be done to improve this.
Shouldn't be deleted right after all subscribers received it? Can you point me in the library where it is stored?
It is stored in each client's queue (AsyncWampConnection.mSendBlock). The GC should handle cleaning up these objects when they are no longer referenced.
but GC does not clean them. thats the whole issue. somehow they stay alive.
Does your memory profiler show which object is holding them? Is it any other object other than AsyncWampConnection.mSendBlock?
is visible in the image, everything is held by ActionBlock
Then I don't believe it is a memory leak. I think in this case that you either have slow clients or that the GC doesn't think it's the right time to clean up the unused references. Not that the GC mechanism is way more complicated than one may imagine and it is non trivial to predict when will it clean up memory. I will add some references to read about this later.
Elad
it must be GC issue or somehow the queue gets flooded cause we have the same clients but none of them is slow. It happens over time like 4-6 hours with the same connections of around 20-30 clients. We are sending 500-1000 messages per second to each client. This started after we increased the number of messages sent and size
It's been a year. Did you find any memory leak?