I have an ASP.net application with c# which uses MS SQL server 2005. I find that the cpu usage of my server reaches 100% when ever i run the application. I was told that i may have memory leak in my application. How can i trace is there are any memory leaks in my application? Note: I am not the programmer of this application. But i have the complete source code as i am doing maintenance and enhancements on this application.
After researching why a page I have using an UpdatePanel to perform a refresh every 15 seconds was using up piles and piles of memory over time, I discovered that this is a "well-known" issue with the UpdatePanel not cleaning up properly in IE (some issue with reference counting in COM interop or some such). UpdatePanel does not seem to have this issue in Firefox (haven't confirmed the issue in other browsers).If this is a "well-known" issue, two questions:Is there a "well-known" workaround to this? I know that a full-page refresh will cause the memory to be cleaned up, but some pages may be up for a long time and I don't want to interrupt any user interaction with the page that may be going on. I will if it is required, but it is a sloppy, sloppy UI kluge... you know, one of those "as a self-respecting coder I hang my head in shame at what I have wrought" kind of kluges.Is there any effort being made to fix this? I've looked about, however, most articles on this do not make mention of even MS acknowledging bug status for this while I've seen many telling me why this is an issue, and how it's a "design" thing. I hear IE9 is supposed to take care of this... I guess what you'd call a non-issue, but it will only be available to Windows 7 users.
Coming from WinForms/WPF I've learned the hard way that not remembering to unhook event handlers can lead to memory leaks.
Does this apply to Webapps too? It seems like when the request ends, everything (non-static) should be eligible for garbage collection. Is that true?
I remember jumping through all sorts of hoops to ensure that events got unhooked when an object goes out of scope, especially with multi-threading going on to ensure a responsive UI. Is all of that still necessarily in a webapp or is that one of the luxuries of working with a (mostly) RESTful model?
The application pool randomly shuts down. I am assuming this is due to Rapid Fail Protection and errors are occuring that are triggering it. However... there are no errors being reported in the event logs. So my next inclination is to think of the possibilities of a memory leak. How do you test for memory leaks on a website running locally?
multiple groups of users interacts using browser. in each group, users will interact with some data(objects). the data(objects) are loaded from database. during the interaction, users needs quick and synchronized view of the same data(object), so they must be save in the memory. data(objects) will change during the interaction, but only the final result of this interaction need to be saved back into DB.
My Current Solution
load data(object) into global.asax the manipulate. but for this solution, i got few questions.
how can i make sure the web application have ONLY ONE instance?(configure in iis-->application pool?) because web application would restart by itself, as a result, all data in the application state will lose. how can i avoid application restart by it self rather than managed? in the iis application pool setting, i can set the recycle time, is it guaranteed that no application restart will happen during this time? or is there and event that might trigger something(before application restart) so i can save the current application status and load them back again?
I'm trying to determine the memory used by my ASP.NET MVC application. My host imposes a 100mb application pool memory restriction. However, from my tests, an empty ASP.NET MVC application uses 30mb memory so I have absolutely no hope with an application that actually does something.
I can't find any benchmarks on what a "standard" MVC app should be using (I assume MS have someb somewhere??).
My application is not that special. I use StructureMap for DI and EF Code First. The model is equivelant to that of a blog. If I completely remove my data access code then my memory usage drops to around 40mb (of course in this state its pretty useless).
Bit of a weird title, but here's the deal. For a web site I'm working on, we have the need to generate quasi-3D images on the fly. Basically, it's for an art site, and we have the need to show a 3D representation of a Canvas given a 2D image (jpg). (See here for some context.) The approach we're taking is to leverage the WPF 3D API and create a Viewport3D in code, add a bunch of points to it with the correct dimensions, and then apply the textures from the original jpg appropriately. While testing it, I was testing it the whole time in a sandbox environment, and in the built in Cassini web server in Visual Studio. While trying to migrate it over to the actual code repository and testing it there, it stopped working. The image that's pumped out is the correct size, but is completely blank. It's totally black. After hours of banging my head against the wall, I figured out that it's an IIS issue. I created a simple sample app to demonstrate the issue (doesn't add images though it just paints all sides green), however since most of the code is largely irrelevant to the question, I won't put it here, rather I'll post a link to it:
If you do download it and want to run it, in the code behind of Default.aspx you'll see this:
Feel free to change that path to whatever, and make sure that the correct permissions are in place as it'll try to save a file there. If you try that sample in Visual Studio with Cassini, it'll work fine, and you should have a new file called "output.png" which has a green 3D cube. If you try it in IIS, you'll get a blank image. A few points: Before anyone asks, yes, I gave all the proper folders the correct permission issues. I also do the actual 3D generation and image saving on a separate thread with the Apartment state set to STA. know this is a bit of an unusual case of fusing WPF and ASP.Net, but by some chance, Is there some setting in IIS that I need to change? Is there some limitation to the WPF API that won't allow it to run out of IIS?
Running an ASP.NET application in its own app pool on Windows Server 08 / IIS 7.
Server keeps hitting 97% memory usage and sticking there, trying to work out if that is our application's fault.
My main question is, does all of the memory used by an application get displayed as the working set for the w3wp.exe process associated to it? Our application (according to IIS7 and the worker process in task manager) is using less then 350mb. I want to know if it is possible for our application to be using 5GB of memory but only showing 350mb for the process?
I'd like to describe strange issue I've noticed while analyzing my asp.net application in production and ask for some advice or opinion on the following matter.Application usually runs with some 80-90 MB of memory footprint. This seems stable since no memory leaks have been detected so far - no slight increase in memory usage over time. Yet, problem occurs when application pool recycles (I'm using shared hosting and judging by logs it occurs either when app is idle for 20 mins or every ~30 hours - something like that). The issue is that used memory almost doubles for some period on recycle - it goes to some 160-170 MBs without any explanation. This is confusing, since it is common claim that recycling should purge the memory and all other resources - at least I get it that way. System holds this amount of memory for some 7-8 hours and then memory usage drops to it's usual level of 90-100 MB, again, with no apparent reason (at least not know to me).
my web applications app pool configuration is PeriodicRestartMemory : 512000 PeriodicRestartPrivateMemory : 196608
although the virtual memory limit is higher than private memory, app pool is recycled with virtual memory limits exceeded errors in the event log (instead of private memory).
what is the reason for this? how could it exceed virtual memory limits before exceeding private memory limits? it seems that systems other allocations in virtual memory cause limits exceeded before applications private allocations exceed the limits, but what are those allocations of the system? or what is the root cause of this.
Pardon if this is more serverfault vs. stackoverflow. It seems to be on the border.
We have an application that caches a large amount of product data for an e-commerce application using ASP.NET caching. This is a dictionary object with 65K elements, and our calculations put the object's size at ~10GB. Problem:
The amount of memory the object consumes seems to be far in excess of our 10GB calculation. BIGGEST CONCERN: We can't seem to use over 60% of the 32GB in the server.
What we've tried so far:
In machine.config/system.web (sf doesn't allow the tags, pardon the formatting):
processModel autoConfig="true" memoryLimit="80"
In web.config/system.web/caching/cache (sf doesn't allow the tags, pardon the formatting):
privateBytesLimit = "20000000000" (and 0, the default of course) percentagePhysicalMemoryUsedLimit = "90"
Environment: Windows 2008R2 x64 32GB RAM IIS7
Nothing seems to allow us to exceed the 60% value.
I am building an asp.net application, using II6 on windows server 2003 (vps hosting).
I am confronted with an error I didn't receive on my development machine (windows 7, iis 7.5, 64 bit).
When my wcf service tries launching my query running against a local sql server this is the error I receive:
Memory gates checking failed because the free memory (43732992 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
I have both VS 2005 and 2008 installed on my machine. 2005 is fine. For 2008, literally any asp.net project I try to create gets this eror. I try stepping into the code, and the error occurs apparently before anything that I can trap is loaded. There is no information written to the event log. I have tried this with a "Hello World" webpage with nothing else going on. Seems unique to my Windows Server 2003 machine.
I am getting a weird error in asp.net while using leadtools imaging api. Here's the stack trace.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at SetThreadData(_THREADDATA* ) at Leadtools.Codecs.CodecsOptions.Use() at Leadtools.Codecs.RasterCodecs.DoSave(SaveParams saveParams) at Leadtools.Codecs.RasterCodecs.Save(RasterImage image, Stream stream, RasterImageFormat format, Int32 bitsPerPixel)........
I am maintaining C# .NET code written by somebody else, I get following exception few times,Attempted to read or write protected memory. This is often an indication that other memory is corruptThe code structure where I get the above exception is somethign like this,- it is using ref variables in following sequence,Variable-1 and variable-2 are local variables in App1, - App1: func1() which passes these variables reference to func2(), - App1: func2() passes same variables reference via .net remoting to another application (App2).-App2: does the same passes same received reference to another call 2 times.- The execption is occured while returning from App2.
(App1:func1(ref Var1, ref Var2) --> App1:func2(ref Var1, ref Var2) <---App1 .net remoting to App2--> App2:func3(ref Var1, ref Var2)--> App2:func4(ref Var1, ref Var2)-->variables getting updated and function returned to original caller)
My doubts are ,1. Is passing reference variables in such chain is correct? will it cause such exeption? Does .net support ref variable call directly?
Is there a way to get load information on Application Server? How much memory or CPU is being used at a given point? I want to either 1. Limit users to use specific functionality of ASP.NET 3.5 application or 2. Deny users from accessing the application saying "Server is busy at the moment"
I need to auto update application like in wordpress, Application must check if new updates are available, download this updates and install.But I don't know how to install application. Because if some files in bin directory are updated application is restarted.Is it possible to create ASP.NET web application which will be auto updatable?now we have a new technologies, could u please suggest me any kind of soultion for the above problem. here i am enclosing my email firstname.lastname@example.org
I am working on a ASP.NET 2.0 application. I get the following exception sometimes when i access the web application. I believe it is related to the server where the application is hosted? Exception of type 'System.OutOfMemoryException' was thrown. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
I am working on a web app that will heavily rely on configuration. The configuration is also will be written by another process or human. I am looking to get response on best practices in .net 3.5 on how to implement this case. I had used the configuration section of an early version of the Enterprise Library Applications Block. I really liked working with it but from what I hear it is discontinued in current versions. Hence the question... Need to be able to serialize collections, pick up file write event to reload new instance of config into memory.
I have a memory leak somewhere that I cant find. Every few days my server will crash, and just before that I log a ton of SQL errors stating that it is "out of memory".
I cant find it anywhere, all of my connections are being disposed like so:
[Code].... Then I call the connection from my pages like so:[Code]....
That is all pretty straight forward. The connection is disposed because it is implementing the USING clause. I am opening the connection in my connection manager class, and not where it is being utilized?Or, could the problem be in the below method I am using to populate a SqlDataReader:[Code]....
Now, at first it appears as though this could be the problem because the Connection isn't part of a USING clause, however doesn't the 'Data.CommandBehavior.CloseConnection' pretty much do the same thing. This makes sure that the connection is closed when the reader is closed, right? Here is how I call that above reader from my login page code behind:[Code]....
So the DataReader will get closed even without the .Close() because it is in the USING, and the connection should get closed because I specified it in the ExecuteReader paramters right?
I have a memory issue on my websites and am trying to get to the bottom of it. I have downloaded the 14 day trial of ANTS Memory Profiler and have been playing with it to get a grip of what it's telling me. In the memory options on the timeline, I can see Bytes in All Heaps and Private Bytes etc but I am not sure which ones I should be focusing on to see where the memory spikes and doesn't go back down.I am profiling a ASP.NET website using ASP.NET 2.0.
I have set Private Memory limit of 200mb in IIS 7 for an application pool. The Private Working Set memory(Task Manager) for the application is always below 125mb but the number of page faults have increased a lot and application cache is getting cleared frequently after setting the limit.
I haven't set any limit on Virtual Memory.why the cache is getting cleared even when the Private memory used is below the allocated memory?