WampSharp icon indicating copy to clipboard operation
WampSharp copied to clipboard

Memory usages

Open devfxplayer opened this issue 5 years ago • 10 comments

qerver

Hi, Can you please let me know what to do in this case?

devfxplayer avatar Aug 06 '19 11:08 devfxplayer

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.

darkl avatar Aug 06 '19 14:08 darkl

Shouldn't be deleted right after all subscribers received it? Can you point me in the library where it is stored?

devfxplayer avatar Aug 06 '19 15:08 devfxplayer

It is stored in each client's queue (AsyncWampConnection.mSendBlock). The GC should handle cleaning up these objects when they are no longer referenced.

darkl avatar Aug 06 '19 15:08 darkl

but GC does not clean them. thats the whole issue. somehow they stay alive.

devfxplayer avatar Aug 08 '19 11:08 devfxplayer

Does your memory profiler show which object is holding them? Is it any other object other than AsyncWampConnection.mSendBlock?

darkl avatar Aug 08 '19 13:08 darkl

is visible in the image, everything is held by ActionBlock

devfxplayer avatar Aug 09 '19 07:08 devfxplayer

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

darkl avatar Aug 09 '19 10:08 darkl

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

devfxplayer avatar Aug 09 '19 12:08 devfxplayer

Regarding the references I promised you, see my comment here.

Elad

darkl avatar Aug 09 '19 14:08 darkl

It's been a year. Did you find any memory leak?

darkl avatar Aug 23 '20 03:08 darkl