Well, it's been a long night, but I have some good news. undecided). I have modified lib/parse.c:parsedb() to use mmap. In so doing, I was able to eliminate the all varbuf* calls(both field and value) that it did(varbufaddc once for each char in a field name, once for each char in a field value(879493 calls to varbufaddc before, 34796 after)).
Looping 10 times, for dpkg -s libc6 > /dev/null, gives the following numbers: before=0m6.489s, after=0m4.385s I have also implemented section string caching in lib/fields.c:f_section(). Instead of allocating a new section field value each time, I maintain a linear list of previously allocated values, and return from the linked list, if a new value matches. On my system, this is a memory savings of 34865 bytes, but, unfortunately, it appears to slow dpkg down(will check later, it's been a long night). Before I check in the major patch above(which isn't all that large), I need to add autoconf support for mmap, and when mmap isn't available, fall back on buffer_copy into a huge buffer. ----BEGIN GEEK CODE BLOCK---- Version: 3.12 GCS d- s: a-- c+++ UL++++ P+ L++++ !E W+ M o+ K- W--- !O M- !V PS-- PE++ Y+ PGP++ t* 5++ X+ tv b+ D++ G e h*! !r z? -----END GEEK CODE BLOCK----- ----BEGIN PGP INFO---- Adam Heath <[EMAIL PROTECTED]> Finger Print | KeyID 67 01 42 93 CA 37 FB 1E 63 C9 80 1D 08 CF 84 0A | DE656B05 PGP AD46 C888 F587 F8A3 A6DA 3261 8A2C 7DC2 8BD4 A489 | 8BD4A489 GPG -----END PGP INFO-----

