2

I am working with a package that has an algorithm that at some point, if you give it too many inputs, runs out of memory and gives this warning:

warning message system call failed cannot allocate memory

Is there a way to determine how much memory was requested that could not be allocated? I'm trying to determine whether I should/can scale up to a bigger box.

Thanks.

helloB
  • 3,472
  • 10
  • 40
  • 87
  • see `pryr::object_size` – alexwhitworth Sep 20 '16 at 17:51
  • 1
    @AlexW since the allocation that fails is buried deep in a package, I'd rather not have to modify that package. Also if the memory is not allocated, won't there not be an object for which to get the size? – helloB Sep 20 '16 at 17:52
  • Your question is **"how do I determine how much memory was requested to be allocated"**. I answered that question. If you have a different question, please revise your post and provide a reproducible example. – alexwhitworth Sep 20 '16 at 17:54
  • 1
    (A) I don't see how `pryr::object_size` (or equivalent) will help for an object that did not get allocated due to insufficient memory. So question still stands. (B) Adding a reproducible example to the question won't hurt if it is possible. If it is a CRAN library you are using, then providing a short code example that crashes similarly could help. (C) could you try stepping through the code using `browser()`? Then you can check the system state just before the error, and see what the code is doing at the point it crashes. That might give you a clue how much memory is being sought. – dww Sep 20 '16 at 19:53
  • Actually his question in post is more about a request that failed to be executed. The question title didn't include all information which is understandable. – dracodoc Sep 20 '16 at 19:54

1 Answers1

0

A simple search found these possible routes:

  1. If you are using linux, try to change swap.

  2. If you are using RStudio, try R console

  3. If it's possible, try with different system configurations. I think experimenting with different Amazon AWS instance will not cost you too much.

  4. try suggestions in this question. Especially options(error=recover) or debugonce

As others suggested, without a reproducible example it's difficult to get accurate answer to your problem.

Community
  • 1
  • 1
dracodoc
  • 2,603
  • 1
  • 23
  • 33