0

I have followed this

http://blogs.msdn.com/b/ericlippert/archive/2010/06/28/computing-a-cartesian-product-with-linq.aspx

and created a dynamic linq query to compute cartesian product.

I have 10 array item, each has 100 item in it.

A[100] B[100] C[100] . . . J[100]

When I am trying to compute the cartesian product of my A to J array, I get outofmemoryexception.

I am sure somebody already might have faced similar issue. It would be great if you can provide me a solution for this issue.

Esen
  • 973
  • 1
  • 21
  • 47
  • 1
    Looks to me like you could have 100^10 matches, which is about 46.6 *billion* times more than int.MaxValue, for example. – Anthony Pegram Feb 20 '12 at 15:20
  • yes,I figured it out, I was actually storing the combination result in a list which caused this outofmemory exception. Instead of storing all combination, I did the following, for every 10000 combination I take the best one (based on my business logic) store it in a different list and clean up the combination list, it helped me to resolve my issue. – Esen Feb 20 '12 at 17:23

1 Answers1

0

I figured it out, I was actually storing the combination result in a list which caused this outofmemory exception. Instead of storing all combination, I did the following, for every 10000 combination I take the best one (based on my business logic) store it in a different list and clean up the combination list, it helped me to resolve my issue.

Esen
  • 973
  • 1
  • 21
  • 47