Re: valloc()?
Derek Price <[email protected]> Wed, 02 Mar 2005 19:20:32 -0500
| Newsgroups | gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs |
|---|---|
| Organization | Get CVS Support from Ximbiot <http://ximbiot.com>! |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bruno Haible wrote: | Therefore I'd suggest a new interface: void* | pagealign_alloc(size_t); void pagealign_free(void*); | | and do the implementation as follows: - If mmap() is available, use | mmap and some bookkeeping for pagealign_alloc, and munmap() for | pagealign_free, - Otherwise, if posix_memalign() is available, use | it and free(), - Otherwise, use something similar to the valloc() | above. Why do you prefer mmap to posix_memalign? I'm almost done with the implementation you suggested (I'm testing the MMAP version now, then I'll go through with various combinations of HAVE_MMAP, HAVE_MAP_ANONYMOUS, and HAVE_POSIX_MEMALIGN, but it strikes me that my bookkeeping for mmap could slow things down if many blocks were allocated (I'm storing the ptr->size map in a simple linked list, but even something more efficient would eventually slow). Regards, Derek -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCJlhQLD1OTBfyMaQRAijMAKDlaI1EPq2SBaMxtE9bVy6zrZCbRACfUDWw /UHJwKT7V8NkEGaoQ1Ge68A= =qqlR -----END PGP SIGNATURE-----