\w (workspace command)

In the “Q for Mortals” book (2006-2008) on page 240 the workspace command “\w” is documented as yielding 4 integer values (bytes used, bytes allocated, max memory available, and size of mapped files).
On my copy of 32-bit KDB+ for Linux the \w command yields 6 integers (118256 67108864 67108864 0 0 2116919296).

Since there are 2 more integers now reported, what do they represent?

Using the command “\cat /proc/$$/status” I can get the pid of the q session from the PPid of the call to Bash.  Suppose it is 4692.

I can use the command “\cat /proc/4692/statm” which yielded 17339 454 309 128 0 16588 0

The first 3 integers should be the VmSize, VmRss and mapped memory, all in pages.  See the proc(5) man page.

Converting to bytes by multiplying by 4096 gives me 71020544 1859584 1265664 524288 0 67944448 0

None of the results from the call to Linux match the results from \w.

Why?

http://code.kx.com/wiki/Reference/SystemCommands#.5Cv_.5Bnamespace.5D_-_variables

.Q.w

puts that info into a dic which may be easier to reference.

Thanks!

In a fresh q-session on 32-bit Linux (with pid=15535)

q).Q.w
used| 118384
heap| 67108864
peak| 67108864
wmax| 0
mmap| 0
mphy| 2116919296
syms| 567
symw| 18477

q)\cat /proc/15535/maps
“08048000-080c8000 r-xp 00000000 08:03 17096812 /home/tom/q/l32/q”
“080c8000-080c9000 rw-p 0007f000 08:03 17096812 /home/tom/q/l32/q”
"080c9000-08146000 rw-p 00000000 00:00 0 "
“09906000-09927000 rw-p 00000000 00:00 0 [heap]”

“bfb5d000-bfb7e000 rw-p 00000000 00:00 0 [stack]”

Both the stack and the heap each have a size of 135168 bytes
The heap size listed by q is 67108864 (64MB).

Where does that come from?

On Monday, October 27, 2014 11:04:30 AM UTC-4, Tom Szczesny wrote:

Thanks!

kdb+ has its own memory allocator and currently only symbols would appear under the heap entry under maps.
What scenario do you have which makes this relevant?

Thanks Charles.
I don’t know that it is relevant.
Right now, I’m just trying to understand the data that .Q.w provides.