|
Message-ID: <20160802173649.55362.qmail@ary.lan> Date: 2 Aug 2016 17:36:49 -0000 From: "John Levine" <johnl@...gh.com> To: musl@...ts.openwall.com Subject: Re: application frequently map and unmap memory In article <CAAKbDrdMVskT=Azgnu6DPUpAbJa_gToUcq-jjCvRKe7CJmJ22g@...l.gmail.com> you write: >I am looking for real-world applications >I guess if some applications use large chunk of memory, map and unmap >are necessary. >I just am not aware which applications have such requirements. If you just want to use a large chunk of memory, malloc() and free() work fine. Memory mapping is for situtations where you need to share data between applications, or you want to do something on a whole file so it's more efficicient to map the file into memory than to use reads and writes. My version of grepcidr uses mmap so it can scan through whole files as fast as possible. It's like the usual grep utility but specialized to look for IP addresses, typically in large log files. http://www.taugh.com/grepcidr-2/ It uses a state machine to scan through each file which never backs up by more than one character so its usage is map a file, scan through the whole thing sequentially, unmap it, map in the next file, and so forth. R's, John
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.