get_stack_bounds using read(2) syscalls to read /proc/self/maps byte-by-byte

Stephan Bergmann sbergman at redhat.com
Tue Feb 12 09:46:22 PST 2013


On some Linux box (Fedora 18, using 
java-1.7.0-openjdk-1.7.0.9-2.3.5.fc18.x86_64) I happened to look at an 
strace of a LibreOffice process (which can instantiate the JVM 
in-process), and noticed lots of calls to read(2) to read individual 
bytes of /proc/self/maps.

And get_stack_bounds in os/linux/vm/os_linux.cpp indeed calls out to 
os::get_line_chars in share/vm/runtime/os.cpp that does

   read(fd, &buf[i], 1)

This appears to be introduce with 
<http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/677234770800> 
"7017193: Small memory leak in get_stack_bounds 
os::create_stack_guard_pages" to fix 
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7017193> "Small 
memory leak in get_stack_bounds // os::create_stack_guard_pages."

Is this a known performance issue?  A (likely naive) Web search did not 
show anything that looked relevant, but I have vague memories of having 
seen it mentioned somewhere a while ago.

Stephan


More information about the hotspot-dev mailing list