C o n t e n t s Chapter 1: Introduction 1.1 Organization of this Documentation 1.2 A Quick Outline of What this Library is All About 1.3 Description of Features (a) Reliable far memory allocation (b) Dynamic allocation of multi-dimensional arrays in far memory (c) Variable array index bases and negative array indices (d) Array bounds checking (e) Representation of memory areas as 2-D and 3-D arrays (f) Extensive error checking (g) Diagnostic information in a memory allocation log (h) Automatic detection of errors with program termination (i) Reports of far heap structure Chapter 2: The Use of the Library as a Debugging Tool (a) Introduction (b) The Windowing System (c) The Debugging Process Chapter 3: Installation and Use (a) Contents of the disk (b) Use of the library with Microsoft's CL compiler (c) Use of the library with Borland's TCC compiler (d) Installing the library files Chapter 4: Conventions and Utilities (a) The L_MEM.H header file (b) The Dolphin typedefs (c) Errors reported by the functions (d) The SHOWFUNC utility Chapter 5: Description of the Functions 5.1 Memory Block Operations (a) Allocating a memory block mem_alloc() mem_alloc_ch() (b) Memory allocation strategy get_mem_alloc_strategy() set_mem_alloc_strategy() (c) Ascertaining maximum block mem_max() (d) Freeing a memory block mem_free() (e) Setting the elements of a block to some value mem_set() mem_init() (f) Resizing a memory block mem_resize() mem_resize_ch() mem_increase() mem_increase_ch() mem_decrease() 5.2 The Far Heap (a) Dumping the far heap far_heap_dump() far_heap_dump_all() (b) Heap reporting functions heap_ok() far_heap_info() far_heap_blocknum_to_ptr() far_heap_ptr_to_blocknum() top_of_far_heap() below_far_heap() above_far_heap() (c) Walking the far heap this_memory_block() next_memory_block() 5.3 Working with Arrays (a) Allocating an array array_alloc() (b) Simulating an array allocation array2_sim_alloc() array3_sim_alloc() (c) Freeing an array array_free() (d) Array bounds checking array_put() array_get() array_bounds_check() (e) Using non-zero array index bases set_index_bases() get_index_bases() 5.4 The Memory Allocation Log (a) Turning the log on and off set_mem_log() get_mem_log() (b) Log reports mem_log_entries() mem_log_report() mem_log_report_last() (c) Recording array operations in the log set_array_expansion() get_array_expansion() (d) Entering messages in the log mem_log_msg() (e) Compacting the log compact_log() (f) Erasing the log mem_erase_log() 5.5 Program Termination Upon Error Detection (a) Specifying termination errors set_termination_errors() get_termination_errors() (b) Specifying termination log report set_termination_log_output() get_termination_log_output() get_termination_log_report() 5.6 Other Functions (a) Error message mem_err_msg() (b) Hex dump hexdump() hexdump_f() (c) Copy memory memcpy_f() strcpy_fmm() (d) Set memory memset_f() memset_int_f() memset_long_f() (e) Setting memory bounds set_lower_bound() get_lower_bound() set_upper_bound() get_upper bound() check bounds() (f) Library version number get_mem_lib_version_number() Chapter 6: The Demonstration Programs (a) TINYBUG.C (b) LOG_DEMO.C (c) FMALLBUG.C (d) NEG_IND.C (e) HEAPFREE.C (f) HEAPWALK.C (g) HEAPDUMP.C (h) HEXDUMP.C (i) CRIT_ERR.C (j) MEMSTRAT.C (k) INITDEMO.C (l) RESIZE.C Appendix I: Memory Models Appendix II: Listing of L_MEM.H Appendix III: Index of Functions