heap-based pixel cache allocation
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <Pine.GSO.4.44.0401171414140.29988-100000@scooby.simplesystems.org> |
I decided that it is best if the memory allocation for the image pixels is more defensive in order to help avoid run-time memory allocation problems. Therefore, as of today there is this change: * magick/cache.c (OpenCache): While allocating the pixel cache from the heap, reserve enough memory to contain a full PseudoClass image in order to reduce the chance that there will be a memory allocation failure while processing the image. This also avoids the possibility that the image pixels will be block-copied to a new location due to heap memory fragmentation. If there is insufficient heap memory (malloc() fails), then a disk-based pixel cache will be used. For most modern operating systems and modern hardware, this change should usually not result in a change in performance since modern operating systems use the MMU to zero-fill previously unused (clean) memory pages when they are accessed and an allocation does not cause an access. Five quantums will always be allocated from virtual heap memory rather than sometimes allocating four (DirectClass), or sometimes allocating five (PsudeoClass), or allocating four, and then extending the memory allocation to five (DirectClass-->PsudeoClass). Bob ====================================== Bob Friesenhahn [email protected] http://www.simplesystems.org/users/bfriesen ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn