Home Forums Support Odd Memory Leak

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #4101


    Ever since I have added NetworkComms in my project, I’ve noticed that after some days, my computer started to become quite irresponsive (I have a dedicated computer for the application). The problem only went away after a reboot, so I started to keep in under some surveillance.

    The application is an automated stock market watcher that places/closes orders, so it has a connection to the broker (where Networkcomms is being used), so it is basically a background application without any user intervention.

    The number of connections are depending on the number of stocks that are being watched, and they have been incremented allong the past few weeks, and that’s where the problem started to become impossible to manage.

    I decided to take action and grab some data, so here is the result of about 12 hours using networkcomms:
    12hour window

    Interface view

    Assembly view

    Namespace view

    Based on the results, it seems the problem is related with byte[] not being properly handled or references still referenced somewhere.
    This only becomes evident with loads of exchanged information (which is the case of my application).

    Since I don’t have the source code, I decided to implement my own solution using pure sockets and discard NetworkComms completly from the project and after about 10 hours of coding, I had a solution that could replace NetworkComms with minimal code change on the main application, so the previous beheviour was exactly the same but with a different layer of communication between client (application) and the server (broker).

    The results are exactly what I was hoping for:
    Custom solution results

    I will probably will not use NetworkComms anymore because I only bought it to avoid having to write my own client/server communication interface, but since I have done it already, there is no reason to go back.

    Hope this post helps you and other users.


    • This topic was modified 8 years, 9 months ago by .
    • This topic was modified 8 years, 9 months ago by .
    • This topic was modified 8 years, 9 months ago by .

    Hi Joao,

    An increase of 32MB over a 7 hours is similar to what you might expect if the garbage collector is never being called in .Net. Specially I see the memory increase of ‘System’ is considerably higher than ‘NetworkCommsDotNet’. Since you are primarily dealing with raw byte[] my guess is in your much simpler solution is reusing buffers more easily. This is something that is much more difficult to achieve by default in NetworkComms.Net as it also handles the serialisation, compression and encryption of data inline where required.

    I would recommend you try using NetworkComms.Net and ensure you disable the serialisaiton and compression stages, which is discussed here https://networkcomms.net/send-receive-options/. In this mode NetworkComms.Net is much higher performance in terms of RAW throughput and also memory usage. The only downside is that you are limited to sending only byte[] and without compression.


Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.