This seems to be a popular reinvention. There are three different variants in the Android tree, and at least another independent one (intended for Android) on github.
This is the minimal intersection of them all, which will hopefully still be useful. (It's very close to the system/extras/ Android one, but assumes that the user can just run under nohup(1) rather than needing the tool to daemonize itself.) There's not much motivation for the for loop rather than a call to memset(); that was just intended as paranoia against "can something cheat me out of my dirty pages?". This still repeats every 256 bytes, though, and I don't have any concrete example of where duplicate page detection or compression kicks in, so although calloc() would not be a suitable replacement, memset() might well be. --- toys/pending/memeater.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 toys/pending/memeater.c
0001-memeater-consume-a-given-amount-of-memory.patch
Description: Binary data
_______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net