List Info

Thread: maximum size of an arraylist




maximum size of an arraylist
user name
2006-03-07 18:36:50
From:    Stacey Levine <staceylMUSICFORASONG.COM>

>My application died with an error leading me to believe
it was
>having an issue with the arraylist running out of space.
The
>machine has 2GB ram so I can't believe that that was
the
>problem.

I can, easily. It's called an infinite loop. Most of us
have done it.
A popular way to do this is to process a dataset until you
reach
its end, but forget to advance to the next record.

By the way, if this arraylist is full of objects, here's a
bit of
code I find useful for debugging:

(In every class - perhaps by inheritance - as close to the
top as
you can
Public ReadOnly _ObjectIdentity As String =
IdentityString(Me)

(In a highly accessible module)
<DebuggerStepThrough()> _
Public Function IdentityString(ByVal who As Object) As
String
  Static sObjectCounter As Integer
  sObjectCounter = sObjectCounter + 1
  Dim st As String = who.GetType.ToString & "
" & _
         sObjectCounter.ToString
  ' objects.Add(New WeakReference(who))
  Return st
End Function

This gives each object a unique identity (obviously useful
when dealing with many instances of a single class) that
includes its actual data type (useful when dealing with
inheritance). Always with the same name, visible near the
top of the local-variables window or easily accessible in
the Command window.

(I have some other code in this module that works with the
commented-out "objects" collection, so I can see
what objects
I have lying around and wonder why they aren't going away
when I think they should.)

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )