Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Outofmemoryexception

Reply
Thread Tools

Outofmemoryexception

 
 
brandonjack007@gmail.com
Guest
Posts: n/a
 
      07-20-2007
I am using Arraylist to populate a drop down

I get outofmemoryexception at this line
for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
{
sHtml.Append("<option value='" + oYearsList.Add(iYear)
+ "'>" + oYearsList.Add(iYear) + "</option>");
}

When I use:
for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
{
sHtml.Append("<option value=2007>2007</option>");
}

I dont get this exception. Is there anything wrong the way I am using
the Add method of Arraylist.

 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      07-22-2007
You are adding items to the ArrayList while you loop through the same
arraylist. Sounds like infinite loop to me, right?

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>I am using Arraylist to populate a drop down
>
> I get outofmemoryexception at this line
> for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
> {
> sHtml.Append("<option value='" + oYearsList.Add(iYear)
> + "'>" + oYearsList.Add(iYear) + "</option>");
> }
>
> When I use:
> for (iYear = 0; iYear <= oYearsList.Count - 1; iYear++)
> {
> sHtml.Append("<option value=2007>2007</option>");
> }
>
> I dont get this exception. Is there anything wrong the way I am using
> the Add method of Arraylist.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.OutOfMemoryException: Out of memory. Versteijn ASP .Net 7 03-07-2008 06:57 PM
Exception of type System.OutOfMemoryException is thrown =?Utf-8?B?U3Rhbg==?= ASP .Net 11 12-28-2004 07:00 PM
OutOfMemoryException Error: Garbage Collector doesn't release memory to OS Pyramis ASP .Net 0 01-25-2004 04:37 PM
OutOfMemoryException =?Utf-8?B?amF6?= ASP .Net 2 12-16-2003 12:41 AM
Base Exception:System.OutOfMemoryException error message =?Utf-8?B?UmlwdWwgSGFuZGE=?= ASP .Net 1 11-18-2003 07:52 AM



Advertisments