why doesn't /proc/self/maps mtime change when memory's allocated?
From: Andy Chittenden
Date: Thu Jul 17 2008 - 10:36:48 EST
Here's a ruby script that when run on 2.6.25 demonstrates that although
the contents of /proc/self/maps changes, its mtime doesn't.
--- start ruby script ---
#!/usr/bin/ruby -w
mapfile = "/proc/self/maps"
oldmtime = File.stat(mapfile).mtime
oldmaps = File.read(mapfile)
arr = Array.new()
for k in 1...10*1024*1024
arr.push(k)
end
newmaps = File.read(mapfile)
newmtime = File.stat(mapfile).mtime
if (oldmaps != newmaps)
if (oldmtime == newmtime)
puts("oldmaps mtime = #{oldmtime}")
puts(oldmaps)
puts("newmaps mtime = #{newmtime}")
puts(newmaps)
end
end
--- end ruby script ---
When I run it, I get this output (the lines with the word [heap] against
them are different (along with others)):
# ./checkmaps.rb
oldmaps mtime = Thu Jul 17 15:32:53 +0100 2008
00400000-00401000 r-xp 00000000 08:01 832446
/usr/bin/ruby1.8
00600000-00601000 rw-p 00000000 08:01 832446
/usr/bin/ruby1.8
00694000-006f7000 rw-p 00694000 00:00 0
[heap]
7f7f64de9000-7f7f64f33000 r-xp 00000000 08:01 57195
/lib/libc-2.7.so
7f7f64f33000-7f7f65133000 ---p 0014a000 08:01 57195
/lib/libc-2.7.so
7f7f65133000-7f7f65136000 r--p 0014a000 08:01 57195
/lib/libc-2.7.so
7f7f65136000-7f7f65138000 rw-p 0014d000 08:01 57195
/lib/libc-2.7.so
7f7f65138000-7f7f6513d000 rw-p 7f7f65138000 00:00 0
7f7f6513d000-7f7f651bf000 r-xp 00000000 08:01 57184
/lib/libm-2.7.so
7f7f651bf000-7f7f653be000 ---p 00082000 08:01 57184
/lib/libm-2.7.so
7f7f653be000-7f7f653c0000 rw-p 00081000 08:01 57184
/lib/libm-2.7.so
7f7f653c0000-7f7f653c8000 r-xp 00000000 08:01 57196
/lib/libcrypt-2.7.so
7f7f653c8000-7f7f655c8000 ---p 00008000 08:01 57196
/lib/libcrypt-2.7.so
7f7f655c8000-7f7f655ca000 rw-p 00008000 08:01 57196
/lib/libcrypt-2.7.so
7f7f655ca000-7f7f655f8000 rw-p 7f7f655ca000 00:00 0
7f7f655f8000-7f7f655fa000 r-xp 00000000 08:01 57197
/lib/libdl-2.7.so
7f7f655fa000-7f7f657fa000 ---p 00002000 08:01 57197
/lib/libdl-2.7.so
7f7f657fa000-7f7f657fc000 rw-p 00002000 08:01 57197
/lib/libdl-2.7.so
7f7f657fc000-7f7f65812000 r-xp 00000000 08:01 57199
/lib/libpthread-2.7.so
7f7f65812000-7f7f65a12000 ---p 00016000 08:01 57199
/lib/libpthread-2.7.so
7f7f65a12000-7f7f65a14000 rw-p 00016000 08:01 57199
/lib/libpthread-2.7.so
7f7f65a14000-7f7f65a18000 rw-p 7f7f65a14000 00:00 0
7f7f65a18000-7f7f65afa000 r-xp 00000000 08:01 831874
/usr/lib/libruby1.8.so.1.8.7
7f7f65afa000-7f7f65cfa000 ---p 000e2000 08:01 831874
/usr/lib/libruby1.8.so.1.8.7
7f7f65cfa000-7f7f65cfe000 rw-p 000e2000 08:01 831874
/usr/lib/libruby1.8.so.1.8.7
7f7f65cfe000-7f7f65d1c000 rw-p 7f7f65cfe000 00:00 0
7f7f65d1c000-7f7f65d38000 r-xp 00000000 08:01 57191
/lib/ld-2.7.so
7f7f65eb6000-7f7f65f1c000 rw-p 7f7f65eb6000 00:00 0
7f7f65f33000-7f7f65f37000 rw-p 7f7f65f33000 00:00 0
7f7f65f37000-7f7f65f39000 rw-p 0001b000 08:01 57191
/lib/ld-2.7.so
7fff6df23000-7fff6df39000 rw-p 7ffffffe9000 00:00 0
[stack]
7fff6dffe000-7fff6e000000 r-xp 7fff6dffe000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
newmaps mtime = Thu Jul 17 15:32:53 +0100 2008
00400000-00401000 r-xp 00000000 08:01 832446
/usr/bin/ruby1.8
00600000-00601000 rw-p 00000000 08:01 832446
/usr/bin/ruby1.8
00694000-00714000 rw-p 00694000 00:00 0
[heap]
7f7f590e7000-7f7f5fa09000 rw-p 7f7f65e8d000 00:00 0
7f7f64de9000-7f7f64f33000 r-xp 00000000 08:01 57195
/lib/libc-2.7.so
7f7f64f33000-7f7f65133000 ---p 0014a000 08:01 57195
/lib/libc-2.7.so
7f7f65133000-7f7f65136000 r--p 0014a000 08:01 57195
/lib/libc-2.7.so
7f7f65136000-7f7f65138000 rw-p 0014d000 08:01 57195
/lib/libc-2.7.so
7f7f65138000-7f7f6513d000 rw-p 7f7f65138000 00:00 0
7f7f6513d000-7f7f651bf000 r-xp 00000000 08:01 57184
/lib/libm-2.7.so
7f7f651bf000-7f7f653be000 ---p 00082000 08:01 57184
/lib/libm-2.7.so
7f7f653be000-7f7f653c0000 rw-p 00081000 08:01 57184
/lib/libm-2.7.so
7f7f653c0000-7f7f653c8000 r-xp 00000000 08:01 57196
/lib/libcrypt-2.7.so
7f7f653c8000-7f7f655c8000 ---p 00008000 08:01 57196
/lib/libcrypt-2.7.so
7f7f655c8000-7f7f655ca000 rw-p 00008000 08:01 57196
/lib/libcrypt-2.7.so
7f7f655ca000-7f7f655f8000 rw-p 7f7f655ca000 00:00 0
7f7f655f8000-7f7f655fa000 r-xp 00000000 08:01 57197
/lib/libdl-2.7.so
7f7f655fa000-7f7f657fa000 ---p 00002000 08:01 57197
/lib/libdl-2.7.so
7f7f657fa000-7f7f657fc000 rw-p 00002000 08:01 57197
/lib/libdl-2.7.so
7f7f657fc000-7f7f65812000 r-xp 00000000 08:01 57199
/lib/libpthread-2.7.so
7f7f65812000-7f7f65a12000 ---p 00016000 08:01 57199
/lib/libpthread-2.7.so
7f7f65a12000-7f7f65a14000 rw-p 00016000 08:01 57199
/lib/libpthread-2.7.so
7f7f65a14000-7f7f65a18000 rw-p 7f7f65a14000 00:00 0
7f7f65a18000-7f7f65afa000 r-xp 00000000 08:01 831874
/usr/lib/libruby1.8.so.1.8.7
7f7f65afa000-7f7f65cfa000 ---p 000e2000 08:01 831874
/usr/lib/libruby1.8.so.1.8.7
7f7f65cfa000-7f7f65cfe000 rw-p 000e2000 08:01 831874
/usr/lib/libruby1.8.so.1.8.7
7f7f65cfe000-7f7f65d1c000 rw-p 7f7f65cfe000 00:00 0
7f7f65d1c000-7f7f65d38000 r-xp 00000000 08:01 57191
/lib/ld-2.7.so
7f7f65eb6000-7f7f65f1c000 rw-p 7f7f65eb6000 00:00 0
7f7f65f33000-7f7f65f37000 rw-p 7f7f65f33000 00:00 0
7f7f65f37000-7f7f65f39000 rw-p 0001b000 08:01 57191
/lib/ld-2.7.so
7fff6df23000-7fff6df39000 rw-p 7ffffffe9000 00:00 0
[stack]
7fff6dffe000-7fff6e000000 r-xp 7fff6dffe000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
--
Andy, BlueArc Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/