SWAP - enable or not

Are you going to enable SWAP on your Pandora ?

  • Yes - will have swap partition on NAND

    Votes: 0 0.0%
  • Yes - will have swapfiles/partitions everywhere

    Votes: 0 0.0%

  • Total voters
    25

Code:
while(new int);

I love C++!
This will actually stop eventually, when your computer runs out of memory. new returns null if you're out of allocatable memory, at which point your program will presumably carry on, probably sending the huge amount of memory it's collected to swap to be completely forgotten about, complete its task, exit, and then return the entirety back to the OS.


edit: as opposed to the while(true) method which goes


Program: Give me memory


OS: no, there is no more, you've eaten it all


P: Give me memory!


OS: NO!


P: Give me memory!


OS: fine, I'll kill off some random processes


P: OMNOMNOM! More please


OS: FFFFFUUUUUUUUUUUU
 
Last edited by a moderator:
Code:
while(new int);

I love C++!

for 32-bit:


if i know enough C++, i think this would return false when you request the 4 billionth int (minus something for overhead), then properly exit the app.


a modern x86 machine should handle this quite well.


for 64-bit:


should be fun


EDIT: ninja'd
 
Last edited by a moderator:
While I've voted to have a swap partition on SD, that's not to say I have explicit plans to use it. Linux makes it so easy to enable and disable swap when you need it, if properly configured (use swapon and swapoff). I'll probably make it quite small - maybe up to a gigabyte, since anything needing that much is likely to run like a dog anyway. With a decently sized card I shouldn't miss that much.
 
Back