Arraylist size

Posted by Sunitajadhav under C# on 1/20/2010 | Views : 2769 | Status : [Member] | Replies : 8
Hello friends,
I have to store more than 47 crores values in arraylist.
But i got error about memory exception.What should i do?
Thanks in advance.




Responses

Posted by: RtpHarry on: 1/24/2010 [Member] [MVP] Bronze

Up
0
Down
ok for a minute I was wondering why you would have trouble storing 47 records in an arraylist but then I realised this is another indian number that I didn't know.

I have already learned lakh since I started postin on this site! :)

Anyway I just wanted to point out that there is a method tucked away inside the .net library which will tell you if there is enough memory available to perform a large operation.

Its called system.runtime.memoryfailpoint() and you can use it to detect if the amount of memory that you want to reserve will take you past the memory fail point:

http://msdn.microsoft.com/en-us/library/system.runtime.memoryfailpoint.aspx

Don't know if this will be useful in this particular case but just wanted to let you know!

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/14/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
PLease stop this Sunitajadhav

Thank you for posting at Dotnetfunda
[Administrator]

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 1/20/2010 [Member] Bronze

Up
0
Down
ref


http://en.csharp-online.net/ArrayList

u can add how do u add list check above link


thanks
sagar pardeshi

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 1/20/2010 [Member] Bronze

Up
0
Down
increase run time Array list size C#

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 1/20/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Actually if you are using Normal Array, ArrayList, or HashTable, it is actually creating an array of Structure.

So they will always be contiguous.

If you are looking for Crores of data elements in your list, always use
ystem.Collections.Generic.LinkedList<T>

Which will always give you better performance in such scenarios.

:)

www.abhisheksur.com

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 1/20/2010 [Member] Bronze

Up
0
Down
yes abhi is correct

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mehulthakkar1 on: 1/20/2010 [Member] Starter

Up
0
Down
You should have enough capacity of memory to manage your arralylist in memory. but better way to use all the items in a string variable or stringbuilder object with some delimiter.

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 1/20/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Arraylist are old. i suggest you use list. You can find the in the Generics namespace.

see how to use them and i dont bealive you will this error again. its easy to port them

http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx


Thank you for posting at DotnetFunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Sunitajadhav, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response