-------------------------------------------------------------------------------
$Id: TODO,v 1.16 1994/03/30 06:06:39 gray Exp $
-------------------------------------------------------------------------------

HEAP OPERATIONS:

- realloc should look on either side (preferring above of course) for
	free bblocks and absorb them
	- find free section we can use
	- remove from free list(s)
	- rewrite admin chunks for used
	- rewrite admin chunks for left-overs (if there are any)
	- readd left-overs to free list (if there are any)
- free should look on either side for free space to combine with
	- find free section (above/below/both)
	- remove from free list(s)
	- rewrite admin chunks for new base/size
	- add to correct free list

-------------------------------------------------------------------------------

CHECKING:

- check in heap_check the cleared space above each allocation instead of
	only the fence posts
- maybe add another debug level which stores crc information about internal
	heap structures and verifies it during run time.  slow, slow!!
- maybe add crc information about each memory block into the admin
	structure and then be able to dump which blocks have changed
- maybe add 'use-mprotect' token to allow the user to access only
	user-allocated pages
- try and determine how purify gives the user per-allocation bounds
	checking on READS.
- watch for non-contiguous memory and mark those blocks as external
	- have some sort of EXTERNAL flag
	- make sure checked/freed/realloced/etc. pointers are not in that area
	- we may need to round sbrk() calls if someone else did not do a
		page-size call (see get_bblocks in chunk, need non-alloc flag)
- think of ways we can reorganize the heap and move allocations around
	since problems sometimes pop-up with different heap organizations:

	- pick a random slot from the free-list not just the first entry
	- add new list of dblocks in reverse order to the free-lists or
		randomly disperse
	- maybe when allocating for a block of X bits, get 2 blocks or
		some allocation factor
	- maybe some sort of compact heap orientation like ndt organization.
		- need a different dblock admin maintenance or
		- need to allocate max dblock-admin for every block
	- maybe generate some magical value which corresponds to the
		orientation because you want to be able to reproduce
		the error (bsd random?)
	- probably need an internal randomizer with log-able seed
		value and the ability to set the seed

-------------------------------------------------------------------------------

DOCUMENTATION:

- add more to the debugging section:
	- use of MALLOC_START because a failure is found at some point
		to find the last malloc call
	- use of MALLOC_FUNC_CHECK by inserting malloc_dbg.h and FUNC_CHECK on

-------------------------------------------------------------------------------

GENERAL:

- maybe have some sort etext support for systems that don't have it?
	- etext (heap-start?)
	- end (heap-end?)
- maybe have some sort of memory-stack support:
	- malloc_push_location("foo");
	- malloc_pop_location("foo");
	- have a maximum ~100 entry stack
	- count how deep we are and if we go over don't store but track	so
		when we drop below 100 it will be correct info
	- if we are at an unknown spot, display the top of the stack
- maybe some sort of cheap crc on memory in non-freed memory sections so
	you can see what portions of memory changed (check tripwire)
- maybe provide support for reference counts on allocations:
	- have a call which along with malloc/realloc, increments the
		reference count of the node (maybe duplicate_pointer)
	- free will decrement the reference count and free if 0
	- have a call which reports on the reference count of the node
	- may need additional admin space
	- debug token?
- maybe have bit in allocation struct somewhere that it is a string and
	maybe have a checking level/value that runs though the strings
	and makes sure they have a NULL in them.
	- token 'check-string' or something
	- should only happen if alloc-blank used
	- could be dangerous if folks are changing 'type' of allocation
		from string to ...
- write perl script to summarize the memory usage per file.
- for fence underflow, print out the pointer below's info and for fence
	overflow the pointer above's info
- handle memalign, valloc, maybe some form of mallopt
	- maybe mallopt could be mapped into malloc_debug()

-------------------------------------------------------------------------------

TESTING / STATISTICS:

- maybe use the new gnu testing code
- general tons of small blocks and watch for dblock_admin entry leak
	like with large ndb_shell scripts
- maybe a program that would try a standard set of tests on a number of
	different combinations of debug-values to look for dependencies.

-------------------------------------------------------------------------------
