Solved

Some advice from a .NET expert

Posted on 2012-04-13
2
175 Views
Last Modified: 2012-04-16
We have a software company developing a client for us. The first version of this was server based and created a major issue for us and forced us to roll back. We then asked for a client-side version, but for obvious reasons we are a little nervous in releasing this, making sure enough testing takes place.

The software has been developed in .NET. One of our queries is over the amount of memory used, it can be anywhere up to 125MB used (more than anything else on the client), even when the client is not being used. I understand that this is to speed up the launching of the app, but my concern is the memory used locks at a varying amount each time application goes to an idol state and stays at the level until re launched. Is this normal? We asked the developer and the response was:

the reason that the memory usage is a little random when the IC viewer is closed is because we use a .NET method to dispose of the memory rather than explicitly specifying disposing of objects of when they are no longer required.  This method will check for objects that are not being used at specific points and they will be disposed of accordingly.

Disposing of objects individually is more resource intensive and so re-coding the IC to operate in this way will more than likely have a negative effect on the performance

I appreciate this may be much ado about nothing, due to my lack of understanding, but I just want to make sure this version doesn't have any memory leaks or similar that could cause us more issues. Is there anything specific to ask them or things I should be looking for?

Many thanks.
0
Comment
Question by:IM&T SRFT
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 350 total points
ID: 37842451
One key thing to look at is whether that memory is fully released back to the system when the app is completely CLOSED.  If it is all released when closed, then you do NOT have a memory leak.

With respect to garbage collection, .Net is notoriously greedy and slow.  It is not unheard of for even "simple" apps to balloon up to ridiculous amounts of memory and then keep it even when the app is idle.  If all that memory is released when closed, though, then this is considered normal operation.  The .Net run-time is supposed to be smart enough to release some of the extra memory it is holding if the operating system as a whole gets low and needs some.

Concerning "disposing of objects individually is more resource intensive", that can be true under certain conditions.  Garbage collection is a slow and expensive operation, and forcing the garbage collector to run at the wrong times (such as from within a large loop) can have a serious negative impact on performance.  The garbage collector executes at an indeterminate time, you don't need to worry about it running, but you also never know when it is actually going to run.

Efficiency, however, is a completely different story.  It may be the case that the code is using more memory than necessary due to a poor design, but we can't know that without seeing the entirety of the code.  Again, though, the app may be perfectly fine and you are simply seeing the results of how the .Net run-time works.

Bottom line is the end-user, or a non-programmer, can't know if the application is efficient or not.  They only see a large footprint and think the worst is occurring.  This is a common issue ranted about on EE and the only acceptable answer is, "don't worry about it".  If you trust the developer then this is something you'll just have to deal with and educate the end-user about.  =\
0
 
LVL 9

Assisted Solution

by:wasiftoor
wasiftoor earned 150 total points
ID: 37842738
While i agree with Idle_Mind's perspective of the problem, there are incidents where the situation gets completely out of hand. In those cases code reviews are the only option. Blind Code Reviews are often very time consuming and can lead to dead ends. A more appropriate approach is to use a memory profiler like http://memprofiler.com/

These tools help your take regular snapshots of the applications memory consumption while you use the application and helps with the analysis. This can help identify problem areas. In web applications specifically, developers often forget to kill session variables. which can be a big memory hog.

Good Luck!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now