Memory problem with egui and crossbeam
Hi, I'm having a strange memory problem when using egui and crossbeam.
Basically, I'm making a serial terminal for practice and decided to move the process of reading/writing data to the serial port to a different thread. I'm communicating with the main thread using 2 pairs of crossbeam channels. The first one is for starting and stopping the thread and the second is for sending serial data to the main thread for display and also for sending user data over the serial port.
Now here is the problem.
I'm developing on Windows and when I open task manager I see a sharp increase in memory consumption of the program. The amount of data I actually receive is several times smaller than the memory usage that is shown. I'm appending data to a String and when I clear it I see that the memory is removed. However, the actual size of that string does not correspond to the amount of memory that is being increased. I'm building with cargo build --release.
Here is my test.
I send 10000 bytes of data over COM port. First I recorded with the third-party terminal. I used Bray++ and after receiving the data I don't see any major change in memory usage. It is around 3.3MB before and after. Now on the other hand when I use my version it goes from like 44MB to 47MB! A massive increase in memory usage. When I clear the string it returns to around 44MB. I have no idea what could be causing this behavior.
I left a link to repo if anyone has time for a quick look. The code is relatively short and probably not the best because I'm not very proficient in Rust yet.
Any help or input would be greatly appreciated.