Вопрос по – Почему параллельные коллекции Scala иногда вызывают ошибку OutOfMemoryError?

5

Error: User Rate Limit Exceeded

(1 to 1000000).map(_+3)

Error: User Rate Limit Exceededjava.lang.OutOfMemoryError: Java heap space

(1 to 1000000).par.map(_+3)

EDIT:

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded Christian
Error: User Rate Limit Exceeded Jan
Error: User Rate Limit Exceeded drexin
Error: User Rate Limit Exceeded drexin
Error: User Rate Limit Exceeded Fabian

Ваш Ответ

4   ответа
0

  val threadPool = Executors.newFixedThreadPool(4)
  val quadsMinPar = quadsMin.par
  quadsMinPar.tasksupport = new ThreadPoolTaskSupport(threadPool.asInstanceOf[ThreadPoolExecutor])

9

Error: User Rate Limit ExceededandError: User Rate Limit Exceeded

scala> (1 to 1000000).par.map(_+3)

Error: User Rate Limit ExceededOutOfMemoryErrorError: User Rate Limit Exceeded

scala> (1 to 1000000).par.map(_+3).seq

Error: User Rate Limit Exceeded

2

(1 to 1000000).map(_+3).toList
(1 to 1000000).par.map(_+3).toList

(1 to 100000).par.map(_+3)

(1 to 100000).map(_+3)

List

views.

3

Parallel collections are not specialized, so the objects get boxed. This means that you can't multiply the number of elements with 8 to get the memory usage. Using map means that the range is converted into a vector. For parallel vectors an efficient concatenation has not been implemented yet, so merging intermediate vectors produced by different processors proceeds by copying - requiring more memory. This will be addressed in future releases. The REPL stores previous results - the object evaluated in each line remains in memory.
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Похожие вопросы