Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I just killed the shell that it was running in. By then it was consuming one CPU core, and about 2 GB of RAM.

Then i tried again, in a subshell, and let it run...

  [user@machine] ~ % zsh
  [user@machine] ~ % yes `yes no`
  zsh: fatal error: out of heap memory
  [user@machine] ~ %     

  [user@machine] ~ % bash
  user@machine:~$ yes `yes no`
  bash: xrealloc: ../bash/subst.c:5184: cannot allocate 18446744071562067968 bytes (4297060352 bytes allocated)


I'm surprised bash wasn't able to allocate 16 exabytes, though I will accept it's a fairly large step up from having 4GB allocated. But surely your machine had heaps of memory?


Linux will let you allocate as much memory as you want. It doesn't ever return failure based on available memory. Instead if you attempt to write to memory it will then map memory and if there is none available it will trigger the OOM killer. The kernel will attempt to kill misbehaving processes.

The 4GB limit is maximum memory that can be allocated to a process (this is configurable) http://en.wikipedia.org/wiki/OOM_Killer




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: