Debian Codegraph @

libs/objsize/README

raw
1 What is this?
2
3 This is a small OCaml library for computing size of OCaml values.
4 It computes count of words used for values, count of values' headers,
5 maximal depth of values. There are functions to get size of values
6 in bytes too.
7
8
9 How to use it?
10
11 See objsize.mli for documentation.
12
13
14 How to compile/install it?
15
16 Run "make <target>" in this directory. Useful make targets are:
17 - lib : build objsize library
18 - tests : build tests with fresh-compiled library
19 - install : install package "objsize" using findlib
20 - uninstall : uninstall package "objsize"
21 - clean : clean working directory
22 - tests-installed : clean working directory and build test programs
23 assuming you have installed package "objsize" using findlib.
24
25
26 How it works?
27
28 C-function walks through values and uses header's field "color"
29 to mark visited values, then restores original values' "color".
30 Colors are stored using rle-like compression to decrease memory
31 usage.
32
33
34 Bugs?
35
36 1. Some constant values (like lists of integers) are
37 constructed at compile time and placed outside of both heaps,
38 and size of these values will be returned as 0.
39
40 2. Internal function is not fully tail-recursive,
41 so generally it uses stack proportionally to the depth
42 of the value.
43
44 There is an optimization to handle long lists and some
45 other datastructures: when objsize walks through the
46 structured block, the goto is used instead of recursive
47 call to walk into the last value that should be visited.
48
49 This optimization is not general, and the best solution
50 would be to use heap memory instead of stack memory to store
51 "walk path", but I don't need it now (please contribute
52 if you want).
53
54 3. It requires gnu make. It's possible to write Makefile for
55 nmake, but I have no MSVC to test. The best solution is
56 to use ocamlbuild. Either I will write ocamlbuild script
57 later, or you will contribute it. But it's possible
58 to build without any makefiles: see original Makefile for
59 details.
60
61 4. OCaml 3.11 has new implementation of heap. Versions of
62 objsize >= 0.12 work only with OCaml 3.11 heap, versions
63 of objsize <= 0.11 work only with OCaml <= 3.10.2 heap.
64 Runtime failure will be raised if you link objsize >= 0.12
65 with OCaml < 3.11.
66
67 5. "Bugs" section is too long.
68
69
70 License?
71
72 Dual: BSD/GPL.
73
74
75 Changes?
76
77 0.1 - 2007-12-13 - Initial public release.
78 0.11 - 2007-12-14 - "configure" made right. Now it works on 64-bits too.
79 0.12 - 2009-04-08 - Works with OCaml 3.11, installs with findlib.
80 0.13 - 2009-09-01 - Tiny change about so/dll suffix for unix/windows.
81 0.14 - 2010-01-26 - Fixing so/dll again.
82 Some stack usage optimization,
83 see the modified Bug #2 description.
84 0.15 - 2010-04-15 - Fixing bug appeared in 0.14. (thanks to Steven Ramsay)
85 0.16 - 2010-08-11 - Fixing bug appeared in 0.14. (thanks to SerP)
86
87 Author?
88
89 Dmitry Grebeniuk <gdsfh1 at gmail dot com>