[Toybox] [PATCH] memeater: consume a given amount of memory.

enh enh at google.com
Wed Jan 24 13:46:34 PST 2024


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240124/d3217ee6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-memeater-consume-a-given-amount-of-memory.patch
Type: application/octet-stream
Size: 2055 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240124/d3217ee6/attachment.obj>


More information about the Toybox mailing list