SmartDev
SmartDev

Reputation: 119

exception of type 'system.outofmemoryexception' was thrown

My page throws error exception of type 'system.outofmemoryexception' was thrown .

This happens when i press submit button in submit button there are sqlconnections with stored procedure as im populating grid with data .

It gives error when i put code in submit button. But when i put tht on page load it works good .

Can anyone help me on this .

Thanks, Smartdev

Upvotes: 1

Views: 8604

Answers (4)

Paul Sullivan
Paul Sullivan

Reputation: 2875

See Exception of type 'System.OutOfMemoryException' was thrown for my answer to the same question:

In short you have a recursive call somewhere in your code (and not necessarily on purpose) i.e.

Class A{

    ctor(){
      var a = new A();// oops!!
    }
}

Upvotes: 0

Danvil
Danvil

Reputation: 22981

This means, that you allocated too much memory in your program. Either buy more memory in a hardware retail shop or use less memory in your program.

Upvotes: 3

Justin Niessner
Justin Niessner

Reputation: 245389

Since my comment got upvotes...I figured I'd post it as an answer.

Without seeing all of your code, it's nearly impossible to tell you why you're getting the Exception.

That said, my guess would be that you have a race condition somehwhere in your event handler that is causing the System to run out of memory. Most likely it's either an infinite loop or an un-terminated recursive method.

Upvotes: 4

Dave Markle
Dave Markle

Reputation: 97671

Something strange is happening -- that's all I can tell you from your description.

It could be a bug third-party control. It could be a bug in your code, it could be something "pinning" memory somewhere. You could legitimately be out of memory...

You should post a complete stack trace of the error. Post your memory utilization statistics. Post some code from where you think the error is happening.

Upvotes: 0

Related Questions