- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
http://xkcd.com/394/
Admin
Admin
its memory leak. but the purpose of the program is to do that purposefully to test memory consumed by the process ...
Admin
Even fsync()'ed, the journal isn't guaranteed to be written to disk because of the HD cache. This should at least be ok if the application, or maybe OS crashes but there's no power outage (UPS should be used on any critical computer).
With sparse files (or worst, compressed file systems, but I won't use such a file system), write(2), fsync(2) and fdatasync(2) may fail, for lack of disk space, when writing within the bounds of a file. posix_fallocate(3) is supposed to fix this problem on file systems where this is possible (this should be possible on ext3), but I don't trust the implementation. GLIBC has a BUGGY implementation which doesn't write inside "holes" of sparse files for kernels < 2.6.23. I think writing a generic "posix_fallocate" was a bad idea at first. IMO, this function should be specifically coded for each file system. Fortunately, kernel >= 2.6.23 provides fallocate(), which has to be implemented by the file system driver. I've not yet tested it, but I hope it got things right for ext3.
Thanks to the journal, on low disk space conditions, the program will fail, but can be resumed if disk space is freed. Hard disk physical failure is the ultimate issue. Nothing can be done against that, except backing up and using good disks or RAID1 disks. RAID1 won't protect against failing/buggy disk controllers, though.
Nobody said it was going to be easy. But, some critical applications (e.g. some database engines on critical servers) are designed to cope, as well as they can, with low-disk and low-memory conditions. Overcommitting only makes their task harder for dubious benefits. A watchdog should restart the critical application but an application crash is never good.Admin
Admin
i had to change a couple of things to make it build in xcode:
it still won't crash my system though. it just counts to 3.6 billion. :(
Admin
I like this obfuscated version as a unix shell script.
:(){ :;:; } ;:
Admin
Fixed your post.
Admin
TRWTF is that you think that killing Kicker is a fail of OOM heuristics. I think that Kicker is one of the least critical apps you can have running on you desktop, so it's always better to kill that before anything else. (If we are talking about KDE's Kicker)
Admin
Haha I wrote an app like this whilst learning programming.
It would continously allocate memory whilst using windows API calls to tell you how much you had left :) good times.
Admin
I don't think that is entirely correct. Shared memory will not be released.
Admin
I think this actually is the source for the JVM.
Admin
Shared memory gets released when the last reference to it has gone away.
In a modern OS it's pretty hard to leak real resources because they're very good at cleaning up after themselves.
Also these days the theoretical free memory for an app is bounded by ulimit, addressable space (2gb/3gb depending on OS and configuration eg. windows needs a boot switch to use 3gb) and maximum virtual memory.
Not that it's the whole story - poor memory allocation schemes can reduce that a heck of a lot (the Windows C library is so bad we routinely replace it in production code because it'll fail allocation of a few tens of mb even when there are hundreds of mb free).
Admin
Until the parent either calls waitpid or dies (in which case the child will be inherited by init who will call waitpid) the process will remain a zombie.
A parent who forks children and does not care about their exit status can ignore SIGCHLD, and never a zombie it shall make.
Admin
I don't get the wtf. I tried this (actually a simplified, less stupid version*) on my (Linux x86_64) machine. With -m32 it reported just under 4 GB as expected. With -m64, the mouse got a bit slow around the 500 GB mark, so I ctrl-C'd it. But seriously, if you need 500 GB of address space...
The original submission did, after all, specify this was for use on UNIX platforms.
(* I do however see the WTF in 1024000 == 1 MB. It should be 1<<20, of course.)
Admin
My compiler (clang) eliminated the malloc, and (correctly) made the float undefined, so I just got an infinite loop of nans as output. Go figure.
Admin
Assuming the OS isn't totally broken, memory will be completely freed once the program terminates (or is killed by the user/OS/whatever).
Admin
Fortunately, most GNU tools properly use labatterie SI units.