.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Form background images and memory usage

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :Windows Application
Hello everyone, please forgive me if this is the wrong forum for this post. I have written a Windows App in C#. It's a real small application (something like a widget) that stays on your desktop and shows pictures of a folder in a random sequence. Before showing another picture i use : this.BackgroundImage.Dispose(); so that i keep memory usage low. If i won't do that i can see memory rising (depends on the image size). Now the code i use to change the picture is : this.BackgroundImage = Image.FromFile(path, true); So my question is about this last line of code. Is this a good approach of changing the picture after a while? (this code runs in a loop) Should i care about memory usage? The form is a small one for this kind of app, so loading big and large pictures can have some issues i guess. I have been monitoring my app for some time , memory and cpu usage were really low but i would like to know another and better approach on this one if somoeone knows.  de_Stan

View Complete Post

More Related Resource Links

memory usage (consumption) of individual controls on a web form shown in a browser



Is there a way to check the memory usage (consumption) of individual controls on a web form shown in a browser. Like Repeater Control, Multiline Text box etc. The reason is I am putting the repeater control in session and checking the status of controls, based on which I am doing further actions.



CLR Inside Out: Memory Usage Auditing For .NET Applications


Memory usage can have a direct impact on how fast an application executes and thus is important to optimize. In this article we discuss the basics of memory optimization for .NET programs.

Subramanian Ramaswamy and Vance Morrison

MSDN Magazine June 2009

Design: Inspect and Optimize Your Program's Memory Usage with the .NET Profiler API


Developers using .NET often make memory leak tracking a low priority because the common language runtime takes care of garbage collection. What few developers realize, however, is that their objects' lifespans, along with their size and what other objects have been instantiated, all affect how they are cleaned up. Depending on the particular circumstances, these combinations can negatively affect performance, especially over the lifetime of an application. This article presents a way for developers to see memory usage and understand garbage collection using the .NET Profiler API. Along the way, a sample application to demonstrate these principles is built.

Jay Hilyard

MSDN Magazine January 2003

Div background images not rendering

I'm new building a website.  I just started testing my website with other browsers, and I've noticed the background image for my DIV elements isn't rendering in either  Mozilla Firefox or Google Chrome.  It didn't even render in Explorer on a different computer.  I had to create an image element and draw it behind my content to make a background image.  I'm hardly doing anything more exotic than:    tag  div id="hdr style="width: 625px; height: 58px; background-image: url('file:///C:/__path__/MyImage.bmp'); background-repeat: repeat-x;" close-tag  I now have it rendering properly in all 3 browsers as an image object with content positioned over it.

How to check for Panel background images?

Hi guys, I need your help. I am writing the code on the panel click event that if the image is called testimagesred, then displaying the messagebox.   Private Sub Panel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.Click         If Panel1.BackgroundImage Is My.Resources.Resources.testimagesred Then MessageBox.Show("the images shown as red") ElseIf Panel1.BackgroundImage Is My.Resources.Resources.testimagesgreen Then MessageBox.Show("the images shown as green") End If End Sub When I click on the panel, the messagebox doesn't display when the images are on testimagesred.   Any idea?

SQL 2005 (32-bit) cluster memory usage

We recently did an in-place upgrade of our cluster from SQL 2000 Enterprise to 2005 Enterprise.  We are seeing memory utilization on the server that is not expected and wanted to get an idea from others if this is normal.  Here is our setup:

32-bit Windows Server 2003 SP1
SQL 2005 SP2, 2-node cluster
16 GB memory on each node
/3GB /PAE switches in the boot.ini file
AWE Enabled, min memory=0, max memory=14000

The strange bit is that in the Task Manager the SQL service is showing as only using 205 MB of memory and the pagefile usage is at 13 GB.  This is troublesome since it looks like SQL is using virtual memory instead of physical memory.  We recently upgraded the memory from 4 GB to 16 GB, the sql cluster service account was added to the Lock Pages in Memory policy, the boot.ini switches were set and the AWE enabled/max_server_memory script was run before upgrading to 2005.  Can anyone confirm either 1) this is normal or 2) how to correct the memory usage?

I have also questioned using the /3GB switch; would it be better to remove that and set the max memory for SQL to 12000?

Any help would be greatly appreciated.  If I left off any information that would be helpful, please let me know.


upload images to a picture library from infopath form



   I am having an infopath form, from where i need to upload images to picture library . 

User selectable background image for Form.


I have played around with the BackgroundImage option in C# and it works very well. My question is related to having the user select the image that will be the "Skin". Does anyone have or know where to find a good sample application that does something like this?

Thank you!


Drag and drop images to form groups


My daughter is in kindergarten and the teacher asked me to help, I need to do a web page that will display images in one area, and allow them to be dragged to groups to categorize them, I guess I could add the needed number of panels for the groups but don't know about the dragging and dropping.  

Any help greatly appreciated,

Sr. Involved Parent. 

SQL Server 2008 Memory Usage


We are using SQL Server 2008 x64 SP1 CU8 EE, and we have 32 GB of RAM on the server. We currently have the instance restricted to 14 GB of RAM, the "Lock Pages in Memory" security setting on the service account, and AWE enabled in SQL Server. This server is part of a 3 node active/active/passive cluster. My question is:


How do I know how much memory sql server is actually using, or if the server is under memory pressure? 

John M. Couch

sql server high memory usage


Hello Guys

just wondering how do you handle similar situation, we had a call from angry client saying they are unable to do anything and things take too long to complete. when i logged in i noticed that sql server taking all memory (6GB) for some reason. interestingly CPU usage is normal.

I know i can run profiler to see what queries are taking such huge memory before it happens but what if it already happened and you want to see whats currently eating all that memory ? thanks for the advise.

sql server is 2008 and our desktop app is C# 2008.


Memory usage per message.


I have a WCF web service and I want to find out a memory profile of the service per message. In other words I want to issue a message service request from a client and after the message is serviced and a response is received I want to find out (preferably from the client) how that message affected the memory footprint of the service. What tools are readily available? I am aware of several profiling tools from third parties but I want to know how I can integrate the information available through the Performance Monitor and Task Manager (for example) with the message processed to yield a profile of what each message does to the memory footprint. This could be used as a leak detection (if the memory after is more than the memory before then that message more than likely has a leak). If the memory statistic was available during the message processing it could be seen that message A consumes alot of peak memory whereas message B consumes relatively little. Ideas?

Thank you.


Form Background Color not setting



I am developing Addin for outlook and I have Windows form for which I set background color it is not setting to the color whatever I set. you help me to figure this out to reflect the required color.


Malik Z.

Form Background Color not setting



I am developing Addin for outlook and I have Windows form for which I set background color it is not setting to the color whatever I set. you help me to figure this out to reflect the required color.


Malik Z.

Struct Memory Usage - clarification


class Program

        static void Main(string[] args)
            var prg = new Program();

Configuring AWE and memory usage in SQL Server 2005

Dear Sirs,
I installed SQL Server 2005 Enterprise Edition (with SP3) on a server running Windows Server 2003 Enterprise Editon SP2 with 8GB RAM and with "Physical Address Extension".
I want the SQL Server 2005 makes use of memory that is in excess of 4 GB and will perform the following steps to accomplish this:

1) I'll add the SQL service account to the
policy "lock his pages in memory"

2) I'll include the /PAE switch in Boot.ini

3) I'll change the "awe enabled" with the following commands:

sp_configure 'show advanced options', 1
sp_configure 'awe enabled', 1

4) I'll change "min server memory" and "max server memory" with the following commands:

sp_configure 'min server memory', 1024
sp_configure 'max server memory', 8192

SQL Server 2008 - High Memory Usage


Hi ,

  We are facing problem with the high memory usage with SQL Server 2008. 64 bit , standard edition sp2 . 8 GB RAM , 8 processors .

Memory usage keep on growing ..sometimes it will reach to 7.5 GB also .... and its not coming down ..untill we restart the service...

These are the details of DBCC MEMORYSTATUS :: Please suggest how to overcome this problem

Memory Manager                           KB
---------------------------------------- -----------
VM Reserved                              8484792
VM Committed                             4220368
Locked Pages Allocated                   0
Reserved Memory                          1024
Reserved Memory In Use      &n

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend