Changeset

4950:02e5e9fa37b8

util.pposix: Add comments to mallinfo fields we use, so I don't forget tomorrow what they mean
author Matthew Wild <mwild1@gmail.com>
date Sun, 08 Jul 2012 18:54:30 +0100 (2012-07-08)
parents 4948:2c1de519f639
children 4951:e3ff2656cb37 4952:0e9a5b63206a
files util-src/pposix.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util-src/pposix.c	Sun Jul 08 18:48:28 2012 +0100
+++ b/util-src/pposix.c	Sun Jul 08 18:54:30 2012 +0100
@@ -622,14 +622,20 @@
 {
 	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;