Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible leak in DICOMSCU #83

Open
jakubsuchybio opened this issue Nov 16, 2020 · 2 comments
Open

Possible leak in DICOMSCU #83

jakubsuchybio opened this issue Nov 16, 2020 · 2 comments

Comments

@jakubsuchybio
Copy link

jakubsuchybio commented Nov 16, 2020

Hi,
I'm evaluating Evil-DICOM for our company's usage.
And going through the code I probably found a bit of memory leak in

        public bool Ping(Entity ae, int msTimeout = 0)
        {
            msTimeout = (msTimeout == 0) ? IdleTimeout : msTimeout;

            var responseSuccess = false;
            var ar = new AutoResetEvent(false);
            DIMSEService.CEchoResponseReceived += (res, asc) =>
            {
                responseSuccess = true;
                ar.Set();
            };
            SendMessage(new CEchoRequest(), ae);
            ar.WaitOne(msTimeout); //Give it 3 seconds
            return responseSuccess;
        }

Here the CEchoResponseReceived handler is added, but never removed. I looked at the implementation of DIMSEService and didn't find any logic that would be resetting this handler

@rexcardan
Copy link
Owner

jakubsuchybio - hopefully you decided not to use Evil DICOM for your company. I appreciate that you would even consider it, but this project is my own personal DICOM library not a commercial product. It would not be a good idea to base a commercial product on this library because it is not supported in the way you would need.

As far as the leak goes, thank you for pointing it out. I will try to patch. Better yet, this is an open source project! Feel free to patch and issue a pull request.

@jakubsuchybio
Copy link
Author

Don't worry, when we use some OSS in our company, we have a process not to let third party changes break us, by using a fork managed my us. And when we do some fixes on that fork, we gladly provide them back to OSS. So even when we would use Evil-Dicom, we would take a deep look at it before using it in our sw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants