Reported memory usage mismatch between "ps" and "time"
I'm hacking on a GTK+ binding[0] for ikarus, and found the following discrepancy between the memory usage report of "time" from the (ikarus) library and what the UNIX "ps" command reports, when running this code:
(import (rnrs base)
(rnrs control)
(only (ikarus) collect nanosleep time)
(sbank typelib))
(read) ;; At this point, "ps v" reports "72133 46816" (70.4 MB virtual, 45.7 MB resident)
(let ((main
(time-it
(let ()
(main)) ;; At this point, "ps v" reports "146673 49060" (143.2 MB virtual, 47.9 MB resident)
The output from "time" is:
running stats for (let () (typelib-import (prefix (only ("Gtk" #f) main) gtk-)) gtk-main):
no collections
20 ms elapsed cpu time, including 0 ms collecting
17 ms elapsed real time, including 0 ms collecting
1402960 bytes allocated
So that's an allocation of 1.3 MB, which roughly corresponds to the increase in resident size, and seems pretty decent, given what the code does behind the scenes. The increase in virtual size, however, is a whopping 72.8 MB, or a doubling in size. This also doesn't go down when calling (collect) in a loop with sleeps inbetween. So I wonder: why does ikarus claim so much memory it *apparently* (I'm taking a wide shot here) doesn't need?
This testing was done on a AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ with 4GB RAM running Ikarus Scheme version 0.0.3+ (revision 1628, build 2008-10-17, 64-bit) on top of an up-to-date Debian GNU/Linux sid (unstable) installation.
[0] Actually, it's using the gobject-
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Andreas Rottmann
- Solved:
- Last query:
- Last reply: