Showing posts with label systemoutofmemoryexception. Show all posts
Showing posts with label systemoutofmemoryexception. Show all posts

Thursday, March 22, 2012

System.OutOfMemoryException

Hi,
We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory error.
The computer has enough memory, in fact, when the error takes place there
are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often, so,
we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB of
physical memory available?
Thank you very much,
Any guidance will be appreciated.A common source of memory problems is not closing database connections.
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...
> Hi,
> We have an application using .NET framework 1.1 and SQL Server 2000. The
> application seems to be running very well until we get an OutOfMemory
> error. The computer has enough memory, in fact, when the error takes place
> there are 2 GB available in physical memory.
> Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
> before recycling.This made the session information be lost quite often,
> so, we decided to increase the limitation to 3GB and then, we got the
> OutOfMemory error, although our server has 8GB of physical memory and only
> 3GB is used by SQL Server. Now we have the Maximum used memory (in
> megabytes) to 2100.
> Do you have any clue about why we have memory problems when there are 2GB
> of physical memory available?
> Thank you very much,
> Any guidance will be appreciated.
>
unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max you
can set the memory to.
-- bruce (sqlwork.com)
"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...
> Hi,
> We have an application using .NET framework 1.1 and SQL Server 2000. The
> application seems to be running very well until we get an OutOfMemory
> error. The computer has enough memory, in fact, when the error takes place
> there are 2 GB available in physical memory.
> Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
> before recycling.This made the session information be lost quite often,
> so, we decided to increase the limitation to 3GB and then, we got the
> OutOfMemory error, although our server has 8GB of physical memory and only
> 3GB is used by SQL Server. Now we have the Maximum used memory (in
> megabytes) to 2100.
> Do you have any clue about why we have memory problems when there are 2GB
> of physical memory available?
> Thank you very much,
> Any guidance will be appreciated.
>
Thank you very much for your help. I have the /3GB in our boot.ini file:
[boot loader]
redirect=UseBiosSettings
timeout=30
default=multi(0)disk(0)rdisk(0)partition
(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WIND
OWS="Windows Server 2003, Enterprise
3GB" /fastdetect /3GB /PAE /redirect /NoExecute=OptOut
Are there anything else we can do in order w3wp.exe to be able to use more
than 2 GB?
Thanks a lot.
"bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com>
escribi en el mensaje news:%237F$M4ZCHHA.5012@.TK2MSFTNGP06.phx.gbl...
> unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max
> you can set the memory to.
> -- bruce (sqlwork.com)
> "Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote in message
> news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...
>
Are you doing any work like dynamically generating images using GDI?
If so you might want to make sure that the code cleans up after itself
correctly or your server memory will go through the roof!
On Thu, 16 Nov 2006 08:16:08 +0100, "Carmen"
<quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote:

>Hi,
>We have an application using .NET framework 1.1 and SQL Server 2000. The
>application seems to be running very well until we get an OutOfMemory error
.
>The computer has enough memory, in fact, when the error takes place there
>are 2 GB available in physical memory.
>Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
>before recycling.This made the session information be lost quite often, so,
>we decided to increase the limitation to 3GB and then, we got the
>OutOfMemory error, although our server has 8GB of physical memory and only
>3GB is used by SQL Server. Now we have the Maximum used memory (in
>megabytes) to 2100.
>Do you have any clue about why we have memory problems when there are 2GB o
f
>physical memory available?
>Thank you very much,
>Any guidance will be appreciated.
>
--
Bits.Bytes.
http://bytes.thinkersroom.com

System.OutOfMemoryException

Hi,

We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory error.
The computer has enough memory, in fact, when the error takes place there
are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often, so,
we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB of
physical memory available?

Thank you very much,
Any guidance will be appreciated.A common source of memory problems is not closing database connections.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitarestowrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

Hi,
>
We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory
error. The computer has enough memory, in fact, when the error takes place
there are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often,
so, we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB
of physical memory available?
>
Thank you very much,
Any guidance will be appreciated.
>


unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max you
can set the memory to.

-- bruce (sqlwork.com)

"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitarestowrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

Hi,
>
We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory
error. The computer has enough memory, in fact, when the error takes place
there are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often,
so, we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB
of physical memory available?
>
Thank you very much,
Any guidance will be appreciated.
>


Thank you very much for your help. I have the /3GB in our boot.ini file:

[boot loader]
redirect=UseBiosSettings
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise
3GB" /fastdetect /3GB /PAE /redirect /NoExecute=OptOut

Are there anything else we can do in order w3wp.exe to be able to use more
than 2 GB?

Thanks a lot.

"bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com>
escribi en el mensaje news:%237F$M4ZCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max
you can set the memory to.
>
-- bruce (sqlwork.com)
>
"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitarestowrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

>Hi,
>>
>We have an application using .NET framework 1.1 and SQL Server 2000. The
>application seems to be running very well until we get an OutOfMemory
>error. The computer has enough memory, in fact, when the error takes
>place there are 2 GB available in physical memory.
>Some days ago, we have a limitation in memory for DefaultAppPool of 1,5
>GB before recycling.This made the session information be lost quite
>often, so, we decided to increase the limitation to 3GB and then, we got
>the OutOfMemory error, although our server has 8GB of physical memory and
>only 3GB is used by SQL Server. Now we have the Maximum used memory (in
>megabytes) to 2100.
>Do you have any clue about why we have memory problems when there are 2GB
>of physical memory available?
>>
>Thank you very much,
>Any guidance will be appreciated.
>>


>
>


Are you doing any work like dynamically generating images using GDI?
If so you might want to make sure that the code cleans up after itself
correctly or your server memory will go through the roof!

On Thu, 16 Nov 2006 08:16:08 +0100, "Carmen"
<quitaresto@.cpachecoe@.fcc.es@.quitarestowrote:

Quote:

Originally Posted by

>Hi,
>
>We have an application using .NET framework 1.1 and SQL Server 2000. The
>application seems to be running very well until we get an OutOfMemory error.
>The computer has enough memory, in fact, when the error takes place there
>are 2 GB available in physical memory.
>Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
>before recycling.This made the session information be lost quite often, so,
>we decided to increase the limitation to 3GB and then, we got the
>OutOfMemory error, although our server has 8GB of physical memory and only
>3GB is used by SQL Server. Now we have the Maximum used memory (in
>megabytes) to 2100.
>Do you have any clue about why we have memory problems when there are 2GB of
>physical memory available?
>
>Thank you very much,
>Any guidance will be appreciated.
>


--

Bits.Bytes.
http://bytes.thinkersroom.com

System.OutofMemoryException - Session

Hi

I have an application running on a cluster that's constantly throwing an OutOfMemoryException with the following message
"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'.

In this instance, session state mode is set to 'StateServer' and the only object being stored in the session is a dataset (which is serializable)..

Anyone have any ideas

Thanks!for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!
for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!

System.OutofMemoryException - Session

Hi

I have an application running on a cluster that's constantly throwing an OutOfMemoryException with the following message
"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'.

In this instance, session state mode is set to 'StateServer' and the only object being stored in the session is a dataset (which is serializable)..

Anyone have any ideas

Thanks!for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!

System.OutofMemoryException - Session

Hi

I have an application running on a cluster that's constantly throwing an OutOfMemoryException with the following message
"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'.

In this instance, session state mode is set to 'StateServer' and the only object being stored in the session is a dataset (which is serializable)..

Anyone have any ideas

Thanks!for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!

System.OutOfMemoryException

I just got this error on my server even though I have lots of available memory. I did notice that my aspnet_wp.exe was at 648MB. How can I get the bugger back down to a lower MB usage without restarting the asp worker processor?Not sure why you are getting the error when you have available memory, maybe you incorrectly customised the garbage collection?

As far as reducing memory usage, well there could be multiple efficiencies possible in your code, there is no magic bullet :(.

Cheers
Martin
No, I didn't customize the garbage collection. I wouldn't even knwo where to begin on how to do such a thing. I am looking into my code trying to see where I might have efficiency problems. Mainly looking at if I dispose of all my object correctly. If I dispose of my objects in the finally block will that get remove them from memory?

Thanks.
Garbage collection usually manages the clean up of .Net objects. Although it is possible, MS recommends that you do not modify the behavior of the garbage collector so don't let me put bad ideas into your head :).

As far as disposing of objects, you usually only need to woory about that for unmanaged objects (legacy). How large is your code, can you put up a sample?

Cheers
Martin
Are you storing a lot of stuff in cache or session variables?
Rethink your design or let somebody do a code review ...
I would like to do a code review. What is the best way to do this?

System.OutOfMemoryException

What should I do to combat this error? I am doing fairly heavy dataset caching on my webapp. I have 2 gigs memory, and aspwp.exe is using up to 1.3gigs. This caching is essential to my application as it saves ALOT of database queries.

I thought asp.net would recycle what it needed to. Is the best solution to just thro more RAM at it? Thats what I plan on doing, but its going to take a few days to get the server up and running and need a solution in the meantime. Also I am worried what is going to happen when I have my server maxed out on ram usage and I get this error

thanks for any help

mike123Are you setting any priority on the cache items when adding them? Reason I ask is that if everything is being set to "high", it may not be recycling anything w/ the garbage collection.

Also, when you add things to cache, are you checking to see if they already exist or possibly even deleting the old cache before adding it again?
Are any of your caches set to time out (I would think so).

If your cache is too broad, I can see this being a problem. If you are caching a search page, it would be very possible for you to hit the limit of your RAM.

Charley.
I am not setting priority on anything, not high or low. Here is an example of how I cache my dataset. I'm not sure about deleting the old cache before adding it again, because I dont think that happens since I check before I add, please correct me if im wrong on that.

Also, Charley I believe you may be exactly correct on the searches taking all of my memory, I am looking at making them expire quicker and setting their priority low. Is this what you would recommend? How would you modify this function?

Thanks alot
mike123

Public Function QuestionsGet(ByVal userID As Integer) As DataSet

Dim myDataSet As New DataSet()

If HttpContext.Current.Cache.Get("select_questions" & CStr(userID)) Is Nothing Then

' Create Instance of Connection and Command Object
Dim objConn As New SqlConnection("uid=")
Dim objCommand As New SqlDataAdapter("select_questions", objConn)

' Mark the Command as a SPROC
objCommand.SelectCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterUserID As New SqlParameter("@.userID", SqlDbType.Int, 4)
parameterUserID.Value = userID
objCommand.SelectCommand.Parameters.Add(parameterUserID)

'Fill the DataSet
objCommand.Fill(myDataSet, "select_questions")
HttpContext.Current.Cache.Item("select_questions" & CStr(userID)) = myDataSet

Else
myDataSet = CType(HttpContext.Current.Cache.Get("select_questions" & CStr(userID)), DataSet)
End If

Return myDataSet

End Function
Tell us a bit about what you are trying to accomplish.

What type of data are you returning?

I see 'questions' based by the user Id.

Are these very static?

If so, a different way to approch this might be to generate an XML file durning a nightly batch, and instead of reading the DB, read that file instead...
They are fairly static I have probably 20k cached, but not static enough to do a nightly update I believe. I have at least a few hundred changing daily. They are directly tied to users info, I have cached each users info. The data is about 8 text strings shorter than 500 chars.

Thanks for the suggestion, but I dont think it will work in this case. What do you think?

Also, I am attempting to add ", Caching.CacheItemPriority.Low" to my cache statement, but its not accepting the final argument. Am I approaching this wrong?

Thanks again
mike123
anyone? I'm still getting this error and have no idea what to do! :(

thanks again
mike123
Mike.

I'm just throwing out ideas here...

Instead of caching the datasets, have you tried caching the page itself?

Some other options are (Not saying these are the BEST options, but options nonetheless):
- Disable caching until you get more RAM
- Reevaluate queries and see if you can combine anything
- Reevaluate your architecture so that you aren't as database intensive on any given page

Are your pages hitting directly against the database?
Charley,

Unforunately I can't output cache the page, because I need to manually expire it when certain occurances happen. One page in particular has 4 queries, and is being hit about 1 million times per day, so if I lose the caching my database server is going to have soem seroius extra load on it. I would love to get more RAM, however I need a scalable solution and I dont want the same thing to happen when I max out on my new server with 4gigs instead of 2.

Thanks for the input

mike123
4 million queries a day... yowsers...

What the heck kind of app is this?

Have you done performance monitoring on the SQL server?

If you have caching off, does it peg that server?
It's a web app where users have their own personal page, that is database driven. Yes, it sure does peg the server if I turn caching off so I really appreciate the caching. It just really sucks to have it crap out when it runs out of memory, I thought asp.net would be a little better at handling it.

I can upgrade to 4 gigs, but thats just a temporary solution and its goign to cost alot of time / money.

Thanks

System.OutOfMemoryException in asp.net web application

Hi,

We are getting System.OutOfMemoryException exception in an asp.net
application hosted on IIS.
The problem is popping up randomly once every few days.The web server needs
to be restarted as users keep on getting 'Server Application Unavailable'
otherwise.

Could anyone please tell abt the possible causes and solution for this.

Cheers,
JitenOhboy... it could be due to any number of things, without knowing more about
your app it would be very hard to tell what is wrong.
You can wire up your app to capture more info on unhandled exceptions, and
you can also use AdPlus in "hang" mode to take a dump of the W3WP.exe or
ASP_NET.EXE process.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"jiten" wrote:

Quote:

Originally Posted by

Hi,
>
We are getting System.OutOfMemoryException exception in an asp.net
application hosted on IIS.
The problem is popping up randomly once every few days.The web server needs
to be restarted as users keep on getting 'Server Application Unavailable'
otherwise.
>
Could anyone please tell abt the possible causes and solution for this.
>
Cheers,
Jiten
>
>
>


One of the most common culprits is inproc session management. If you store a
lot of data in session variables, consider switching to outproc sessions.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"jiten" <jiten@.discussions.microsoft.comwrote in message
news:398C0A44-231F-40DC-AF02-E8F6965C655A@.microsoft.com...

Quote:

Originally Posted by

Hi,
>
We are getting System.OutOfMemoryException exception in an asp.net
application hosted on IIS.
The problem is popping up randomly once every few days.The web server
needs
to be restarted as users keep on getting 'Server Application Unavailable'
otherwise.
>
Could anyone please tell abt the possible causes and solution for this.
>
Cheers,
Jiten
>
>
>


there are a couple causes:

1) too large session
2) memory "leak" of unmanaged resources. common if you use com object or
don't manage sql connections
3) faulty caching.

start here: http://msdn2.microsoft.com/en-us/library/ms954591.aspx
-- bruce (sqlwork.com)

jiten wrote:

Quote:

Originally Posted by

Hi,
>
We are getting System.OutOfMemoryException exception in an asp.net
application hosted on IIS.
The problem is popping up randomly once every few days.The web server needs
to be restarted as users keep on getting 'Server Application Unavailable'
otherwise.
>
Could anyone please tell abt the possible causes and solution for this.
>
Cheers,
Jiten
>
>
>

System.OutOfMemoryException error

Hi,

I migrated our company's ASP.Net web appplication from a regular Pentium 4
machine to a multiple xeon processors machine. The web application was
acceptable in speed on the old machine, I was expecting to get a better
performance in speed when I did the migration. But neither users or I felt
the difference since the migration.

This is fine. But now I have been getting System.OutOfMemoryException errors
from different ASP.Net pages every now and then on the new machine, same
problems never happened to the old machine. Both machines are running
Windows 2000 sever with SP4.

Any Ideas why System.OutOfMemoryException errors happen to faster machines?

TIAyou probably have thread race conditions that never happened on a single
processor system. check for correct locking on all static variables (vb
modules).

-- bruce (sqlwork.com)

"Ed Chiu" <EdChiu@.discussions.microsoft.com> wrote in message
news:F2D84B2D-4CC6-4DC5-AB4D-D51B16CA5488@.microsoft.com...
> Hi,
> I migrated our company's ASP.Net web appplication from a regular Pentium 4
> machine to a multiple xeon processors machine. The web application was
> acceptable in speed on the old machine, I was expecting to get a better
> performance in speed when I did the migration. But neither users or I felt
> the difference since the migration.
> This is fine. But now I have been getting System.OutOfMemoryException
> errors
> from different ASP.Net pages every now and then on the new machine, same
> problems never happened to the old machine. Both machines are running
> Windows 2000 sever with SP4.
> Any Ideas why System.OutOfMemoryException errors happen to faster
> machines?
> TIA
Thank you for the reponse. But I don't understand you response.

For starter, what is "thread race conditions"? Secondly, why do I need to
lock static variables?

I only have one instance of aspnet_wp .exe running, I do not create web farm
or web garden environment.

Thanks Again

"Bruce Barker" wrote:

> you probably have thread race conditions that never happened on a single
> processor system. check for correct locking on all static variables (vb
> modules).
> -- bruce (sqlwork.com)
>
> "Ed Chiu" <EdChiu@.discussions.microsoft.com> wrote in message
> news:F2D84B2D-4CC6-4DC5-AB4D-D51B16CA5488@.microsoft.com...
> > Hi,
> > I migrated our company's ASP.Net web appplication from a regular Pentium 4
> > machine to a multiple xeon processors machine. The web application was
> > acceptable in speed on the old machine, I was expecting to get a better
> > performance in speed when I did the migration. But neither users or I felt
> > the difference since the migration.
> > This is fine. But now I have been getting System.OutOfMemoryException
> > errors
> > from different ASP.Net pages every now and then on the new machine, same
> > problems never happened to the old machine. Both machines are running
> > Windows 2000 sever with SP4.
> > Any Ideas why System.OutOfMemoryException errors happen to faster
> > machines?
> > TIA
>
> you probably have thread race conditions that never happened on a single
> processor system. check for correct locking on all static variables (vb
> modules).
> -- bruce (sqlwork.com)

I agree.

If both of the following conditions are true:
1. Your database is in an SQL Server or MSDE
2. That SQL Server lives on the same box as your web server
Then:

Beware of "Parallelism". SQL Server, on a multiprocessor box may "break up"
activities of your SQL so that portions of an activity runs in parallel
through multiple CPU's and then SQL Server gathers up the results from each
thread and then serializes them back together. Occasionally, depending on
the nature of the SQL syntax, these "Parallelized threads" can deadlock each
other.

I have only seen this occasionally, but if you want to try it out, dig
through your code to locate any SQL that might be executing when your
application displays this behavior. You can then run SQL Server Query
Analyzer, Set the "Show Execution Plan" option, paste your SQL code, run it,
and then look at the "Execution Plan" tab. If you see any icons that
mention parallelism, then you might consider adding the OPTION (MAXDOP 1)
query hint to your SQL:

SELECT foo
FROM Bar
WHERE fee = fum
OPTION (MAXDOP 1)

"MAXDOP" means "MAXimum Degree Of Parallelism", basically telling SQL Server
to not split the operation over more than one CPU.

If you think that this Parallelism thing is your problem, you can do a "Full
Text Search" on "MAXDOP" in SQL Server Books Online. I cannot imagine why
it doesn't have an index entry.

You could also ask about it over in the
microsoft.public.sqlserver.programming newsgroup.
--
Peace & happy computing,

Mike Labosh, MCSD

"Mr. McKittrick, after very careful consideration, I have
come to the conclusion that this new system SUCKS."
-- General Barringer, "War Games"
I am sorry, the SQL server runs in another server, not with thw web sever.
Please remember we never experienced the same problems with the old web
server.

"Mike Labosh" wrote:

> > you probably have thread race conditions that never happened on a single
> > processor system. check for correct locking on all static variables (vb
> > modules).
> > -- bruce (sqlwork.com)
> I agree.
> If both of the following conditions are true:
> 1. Your database is in an SQL Server or MSDE
> 2. That SQL Server lives on the same box as your web server
> Then:
> Beware of "Parallelism". SQL Server, on a multiprocessor box may "break up"
> activities of your SQL so that portions of an activity runs in parallel
> through multiple CPU's and then SQL Server gathers up the results from each
> thread and then serializes them back together. Occasionally, depending on
> the nature of the SQL syntax, these "Parallelized threads" can deadlock each
> other.
> I have only seen this occasionally, but if you want to try it out, dig
> through your code to locate any SQL that might be executing when your
> application displays this behavior. You can then run SQL Server Query
> Analyzer, Set the "Show Execution Plan" option, paste your SQL code, run it,
> and then look at the "Execution Plan" tab. If you see any icons that
> mention parallelism, then you might consider adding the OPTION (MAXDOP 1)
> query hint to your SQL:
> SELECT foo
> FROM Bar
> WHERE fee = fum
> OPTION (MAXDOP 1)
> "MAXDOP" means "MAXimum Degree Of Parallelism", basically telling SQL Server
> to not split the operation over more than one CPU.
> If you think that this Parallelism thing is your problem, you can do a "Full
> Text Search" on "MAXDOP" in SQL Server Books Online. I cannot imagine why
> it doesn't have an index entry.
> You could also ask about it over in the
> microsoft.public.sqlserver.programming newsgroup.
> --
> Peace & happy computing,
> Mike Labosh, MCSD
> "Mr. McKittrick, after very careful consideration, I have
> come to the conclusion that this new system SUCKS."
> -- General Barringer, "War Games"
>

System.OutOfMemoryException problem

Hi Guys,
I have an aspx page that include some Ajax components (UpdatePanel,
ProgressBar, Extenders) and a wizard for about 15 pages and in every page I
am adding some labels, textboxes, dropdownlists, checkboxes.
and now I'm up to page 8 in my wizard and if I add some more controls in my
wizard page or even moving backward or forward to another wizard page some o
f
the controls will change to gray box with an error like this eg. -(Error
Creating Control -Label65 Exception of type 'System.OutOfMemoryException'
Was Thrown).
I tried close and reopen the application or to restart the computer but
still getting the same error!!!?
Thanks
Regards,
M.RochdiWhat is the system usage of memory like when you start to walk through the
different pages of the wizard? Does it continue to grow?
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:2846DA5C-FE2C-47D0-8828-AB82CF8DBCFE@.microsoft.com...
> Hi Guys,
> I have an aspx page that include some Ajax components (UpdatePanel,
> ProgressBar, Extenders) and a wizard for about 15 pages and in every page
> I
> am adding some labels, textboxes, dropdownlists, checkboxes.
> and now I'm up to page 8 in my wizard and if I add some more controls in
> my
> wizard page or even moving backward or forward to another wizard page some
> of
> the controls will change to gray box with an error like this eg. -(Error
> Creating Control -Label65 Exception of type 'System.OutOfMemoryException'
> Was Thrown).
> I tried close and reopen the application or to restart the computer but
> still getting the same error!!!?
>
> Thanks
> --
> Regards,
> M.Rochdi

System.OutOfMemoryException: Out of memory.

Hello all

I have a ASPX file called scaleimage.aspx that scales my images down
to a given width. This page is used very much in web project I am
working on.

But due to the large size of the images I randomly get [X] images
(error) in Internet Explorer. When I open one individual image at that
point I read this exception:

[OutOfMemoryException: Out of memory.]
System.Drawing.Bitmap..ctor(String filename) +197
tekno.scaleimage.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Any suggestions are more than welcome. I hope you can help me.
Thank you in advance.

Regards,

Freek Versteijn

See here my code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Request("path") Is Nothing Or Request("width") Is Nothing
Then
Return
End If

Dim img As Image = New
Bitmap(Server.MapPath(Server.UrlDecode(Request("path"))))
img = resizeImage(img, Request("width"), 0)

Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.ContentType = "Image/JPEG"

img.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
Response.End()

'Dispose the image object immediately to limit memory use in
case highres/large images are used
img.Dispose()
End Sub

Public Function ResizeImage(ByRef image As Image, ByVal maxWidth
As Integer, ByVal maxHeight As Integer)
Dim imgHeight, imgWidth As Double

Dim bm As Bitmap = New Bitmap(image)

imgHeight = bm.Height
imgWidth = bm.Width

If (maxWidth > 0 And imgWidth > maxWidth) Or (maxHeight > 0
And imgHeight > maxHeight) Then
'Determine what dimension is off by more
Dim deltaWidth As Double = imgWidth - maxWidth
Dim deltaHeight As Double = imgHeight - maxHeight
Dim scaleFactor As Double

'If (deltaHeight > deltaWidth) Then
'Scale by the height
'scaleFactor = maxHeight / imgHeight
'Else
' 'Scale by the Width
scaleFactor = maxWidth / imgWidth
'End If

imgWidth *= scaleFactor
imgHeight *= scaleFactor
End If

Dim w As Integer = Convert.ToInt32(imgWidth)
Dim h As Integer = Convert.ToInt32(imgHeight)
Dim inp As IntPtr = New IntPtr
Dim bmp As System.Drawing.Image = bm.GetThumbnailImage(w, h,
Nothing, inp)

Return bmp
End FunctionHi, Versteijn,

Did you try using the DrawImage method on the Graphics class instead? You
will have to change the following lines:

> Dim inp As IntPtr = New IntPtr
> Dim bmp As System.Drawing.Image = bm.GetThumbnailImage(w, h, Nothing, inp)

to:

Dim bmp As New Bitmap(w, h)
Graphics.FromImage(bmp).DrawImage(bm, w, h)

Hope this helps
Martin
Sorry, it should be another overload:

Graphics.FromImage(bmp).DrawImage(bm, 0, 0, w, h)

It is so easy with the IntelliSence...

Greetings
Martin
"Martin Dechev" <detcheff_@.hotmail.com> wrote in message news:<#uSXmc3$DHA.2660@.TK2MSFTNGP10.phx.gbl>...
> Sorry, it should be another overload:
> Graphics.FromImage(bmp).DrawImage(bm, 0, 0, w, h)
> It is so easy with the IntelliSence...
> Greetings
> Martin

Hi Martin,

Thanks, I'll try it! Why do you think this will spare memory?

Thank you.

Freek Versteijn
Hi, Freek Versteijn,

I don't know from which call the OutOfMemory originates, but I tested with a
2 MB bitmap scaling it to ~75% and it was working with the both methods. As
it is stated in the documentation for the GetThumbnailImage method it gives
good quality for 120x120, but lacks in quality for higher resolutions.

http://msdn.microsoft.com/library/e...mageTopic .asp

Greetings
Martin
"Versteijn" <versteijn@.538mail.nl> wrote in message
news:4d19834f.0403010822.54274e09@.posting.google.c om...
> "Martin Dechev" <detcheff_@.hotmail.com> wrote in message
news:<#uSXmc3$DHA.2660@.TK2MSFTNGP10.phx.gbl>...
> > Sorry, it should be another overload:
> > Graphics.FromImage(bmp).DrawImage(bm, 0, 0, w, h)
> > It is so easy with the IntelliSence...
> > Greetings
> > Martin
> Hi Martin,
> Thanks, I'll try it! Why do you think this will spare memory?
> Thank you.
> Freek Versteijn
> > Hi Martin,
> > Thanks, I'll try it! Why do you think this will spare memory?
> > Thank you.
> > Freek Versteijn

Hi Martin,

Changed my code a bit (see under), but ever call to the page uses
about 10-50 mb RAM, which is not freed after the response has been
send. After a while the process can't address any more memory.

The cause of the high memory use is the GetThumbnailImage function.

Regards,

Freek Versteijn

Here is my current code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Request("path") Is Nothing Or Request("width") Is Nothing
Then
Return
End If

Dim bmp As Bitmap = New
Bitmap(Server.MapPath(Server.UrlDecode(Request("path"))))
ResizeImage(bmp, Request("width"), 0)

Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.ContentType = "Image/JPEG"

bmp.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
Response.End()

'Dispose the image object immediately to limit memory use in
case highres/large images are used
bmp.Dispose()
End Sub

Public Sub ResizeImage(ByRef bmp As Bitmap, ByVal maxWidth As
Integer, ByVal maxHeight As Integer)
Dim imgHeight, imgWidth As Double
Dim bm As Bitmap = New Bitmap(bmp)

imgHeight = bm.Height
imgWidth = bm.Width

If (maxWidth > 0 And imgWidth > maxWidth) Or (maxHeight > 0
And imgHeight > maxHeight) Then
'Determine what dimension is off by more
Dim deltaWidth As Double = imgWidth - maxWidth
Dim deltaHeight As Double = imgHeight - maxHeight
Dim scaleFactor As Double

'If (deltaHeight > deltaWidth) Then
'Scale by the height
'scaleFactor = maxHeight / imgHeight
'Else
' 'Scale by the Width
scaleFactor = maxWidth / imgWidth
'End If

imgWidth *= scaleFactor
imgHeight *= scaleFactor
End If

Dim w As Integer = Convert.ToInt32(imgWidth)
Dim h As Integer = Convert.ToInt32(imgHeight)
Dim inp As IntPtr = New IntPtr
bmp = bm.GetThumbnailImage(w, h, Nothing, inp)
End Sub