stop using mmap for zip I/O
Christos Zoulas
christos at zoulas.com
Tue Mar 3 13:55:35 UTC 2015
On Mar 3, 2:41pm, dmitry.samersoff at oracle.com (Dmitry Samersoff) wrote:
-- Subject: Re: stop using mmap for zip I/O
| Christos,
|
| JVM install it's own signal handler and use it to numerous tasks, so add
| signal handler to zip_util.c is problematic.
Yes, I understand; this is why I mentioned that we not change it
until the pure java implementation is released.
| The simplest way to address the problem is use mlock/munlock to test
| page presence before touching it.
|
| i.e. add code like
|
| if ((i % 4096) == 0) {
| if ( mlock(v+i, 4096) < 0) {
| printf("No page. Bail out\n");
| return;
| }
| }
|
| to *compute()* in your example below.
Yes, that fixes it too, at the cost of more syscalls and complexity...
I just mentioned disable mmap, because it is easy and fixes a common
problem without any performance penalties. Perhaps the mmap code made
sense when it was mapping the whole file, but now mapping just the
central directory doesn't. (IMHO :-)
christos
More information about the core-libs-dev
mailing list