util.pposix: Add comments to mallinfo fields we use, so I don't forget tomorrow what...
authorMatthew Wild <mwild1@gmail.com>
Sun, 8 Jul 2012 17:54:30 +0000 (18:54 +0100)
committerMatthew Wild <mwild1@gmail.com>
Sun, 8 Jul 2012 17:54:30 +0000 (18:54 +0100)
util-src/pposix.c

index 8dfd6c75405be78ff14aee2a5eed11c11d4b5b30..65f8b4ab0389ddbb766f167ad92f1728bd0ec32b 100644 (file)
@@ -622,14 +622,20 @@ int lc_meminfo(lua_State* L)
 {
        struct mallinfo info = mallinfo();
        lua_newtable(L);
+       /* This is the total size of memory allocated with sbrk by malloc, in bytes. */
        lua_pushinteger(L, info.arena);
        lua_setfield(L, -2, "allocated");
+       /* This is the total size of memory allocated with mmap, in bytes. */
        lua_pushinteger(L, info.hblkhd);
        lua_setfield(L, -2, "allocated_mmap");
+       /* This is the total size of memory occupied by chunks handed out by malloc. */
        lua_pushinteger(L, info.uordblks);
        lua_setfield(L, -2, "used");
+       /* This is the total size of memory occupied by free (not in use) chunks. */
        lua_pushinteger(L, info.fordblks);
        lua_setfield(L, -2, "unused");
+       /* This is the size of the top-most releasable chunk that normally borders the
+          end of the heap (i.e., the high end of the virtual address space's data segment). */
        lua_pushinteger(L, info.keepcost);
        lua_setfield(L, -2, "returnable");
        return 1;