Solved

Some advice from a .NET expert

Posted on 2012-04-13
2
185 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

860 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