reimplementation to allow use of glibc

Doesn't quite work completely yet: test4 segfaults because
malloc returns null.  There may be an issue with malloc()
having trouble with a large number of small objects.