-2

I'm lookng for all partitions of a set. For set that contains 12 number it's ok, but for 13 I'm getting out of memory exception. I'm sure of my algorithm. It gives me good result and good number of subsets. For 1, 2, 3... 12.. and then i try to get a 13 and there's a problem.

That's how many is them: WOLPHRAM STRILING

Is there any way to increase memory? Or at least write a method that will gives me with keyword out dynamicly alocated number of parameters?

I'm using the code from the second post: Code of partitioning

Community
  • 1
  • 1
johns
  • 183
  • 1
  • 14
  • 5
    Please post some code, your code is probably using too much memory than needed. – RvdK May 01 '14 at 19:26
  • edited a post and added a link – johns May 01 '14 at 19:36
  • 1
    Do you need to hold all of the partitions in memory at once? Or do you just need to calculate them all as an exercise? What is the code doing that calls `Partitioning.GetAllPartitions`? – Paul Williams May 01 '14 at 19:49
  • You can calculate all possible sets, but do you need to have them all in memory at once? Can you generate them on demand for use in your problem? Can you use multiprocessing or distributed computers or a cloud to calculate parts of the problem with different sets of partitions? – Paul Williams May 01 '14 at 20:07
  • I realize those questions are not what you'd asked, but besides moving to a 64-bit process if you are in a 32-bit process, I think you're going to have to work around a physical computing limitations of an elegant recursive algorithm. – Paul Williams May 01 '14 at 20:12

1 Answers1

1

If I assume correctly what you are trying to do:

Are trying to allocate rougly 630 MB on the LOH! If you are running a 32 bit application you have no chance that whis will work - as .net can use in total up to somewhat 1.4 GB!

On a 64 bit process you should get further: .Net Why can't I get more than 11GB of allocated memory in a x64 process?

Hope that makes things a little clearer!

EDIT What you are dealing with is called "Curse of Dimensionality"

http://en.wikipedia.org/wiki/Curse_of_dimensionality

Community
  • 1
  • 1
toATwork
  • 1,335
  • 16
  • 34