Memory issue with tail command

I am writing some code, that needs to open a file of size 12413 to read
the last line of a timestamp. The command is

timestamp = %x[tail -n 1 #{location}]

every test in rspec that performs this, it erorrs out with a

“cannot allocate memory”

is there a way to read the last timestamp without loading the entire
file in the system, which I imagine that tail does, or maybe someone can
help me figure out why it would be failing?

I found out more information. The problem only comes up when I run the
entire rspec (or at least the models or more). If I run the test by
itself, it won’t error. How in rspec or even more so when running can i
release the memory so that this doesn’t happen?

On Fri, Oct 28, 2011 at 12:15 AM, Jon S. [email protected]
wrote:

I found out more information. The problem only comes up when I run the
entire rspec (or at least the models or more). If I run the test by
itself, it won’t error. How in rspec or even more so when running can i
release the memory so that this doesn’t happen?

Sounds as if the error is in some totally unrelated place. You
probably have created a memory leak. Now this is either an issue in
RSpec or in one of your test definitions. Are you holding on to
objects longer than necessary, e.g. by remembering things in class
instance variables?

Kind regards

robert