Reputation: 411
Is it possible to mmap large amount of address space to /dev/null so all data written to it simply would be discarded?
I need to perform disk/network reads but I don't need readed data (I know, it sounds a little weird) and there is a lot of simultaneous read requests, so I don't want to waste "real" memory for this.
Upvotes: 1
Views: 1824
Reputation: 470
In case it can help anyone trying to mmap /dev/null
: this is actually impossible, and will return error ENODEV (no such device) which means (in this context) that this file cannot be mmaped.
This is because this is a special file for which no mmap operation is available. See http://lxr.free-electrons.com/source/drivers/char/mem.c#L768 for details.
Upvotes: 1