IAsyncEnumerable taking to much proccess memory [Answered]
Is there a way to free up memory after each iteration?
39 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
So this method is being called by the client to upload a file. Now even when process is done. It doesn't seem to free up memory
tebeco#0205
need the full code
Quoted by
<@!689473681302224947> from #IAsyncEnumerable taking to much proccess memory (click here)
React with ❌ to remove this embed.
This is the full. is only getting details about the file. It doesn't hold the data.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes the file isn't being sent all at once. It's being streamed into small chunks. The client-is is a flutter application. Not sure if the code is going to help.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Client:
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes, now before you begin. I know signalR is bad for file transferring 😂
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Any idea, how I could fix this?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Sure let me try it.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
It now looks like this But the process memory is not dropping 😦
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I sent data twice. It went from 130 mb to 460 mb
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Okay let's see 😂
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
The client is sending the bytes as an collection of int's. JsonSerializer had problem converting it. So I had to change from
byte[]
to int[]
.Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I tried using MessagePackProtocol. But the methods on the hub aren't getting triggered.
It could be because of the signalR client that I'm using.
Let me try MessagePackProtocol again. Maybe it will work.
By the I tried calling
GC.Collect
after each iteration and the memory never went up.
But I don't think it's a good idea.Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
You were right, it seems like the GC is getting activated after a certain amount of bytes.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I really appreciate your help mate. Sincerely
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
i would have to re-open signalr code but I think it's because you can't put bare
byte[]
at Channel level
Quoted by
<@!689473681302224947> from #IAsyncEnumerable taking to much proccess memory (click here)
React with ❌ to remove this embed.
Yeah I will take a look into why it's not working and get it to work. It's probably some form of bug from the client side.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I see so something like this
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Just one last question. It seems like I have got MessagePack to work. Is there a way to tell it to serialize enums as name rather than index?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I see, I will take a look at the readme of messagepack. Thank you very much mate.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
✅ This post has been marked as answered!