Re: waste of RAM/bug in render.c?
Wolfgang Spraul <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Organization | Q AG |
| Message-ID | <[email protected]> |
Bob - Just for clarification, I don't have any problem with the 2047 default. My question was about the 'length' calculation in lines 2031-2047. For a simple (but long) line, length will be 6024, and 2047-6024 is negative and thus always < i! Then the array is reallocated to 8071 entries, where only 2 (!) are needed. I have some other speed issues right now, I will let you know if I get back to this reallocation to see whether it is actually needed and in which cases. If you can help me on it, only better! Regards, Wolfgang On Monday 12 January 2004 17:36, Bob Friesenhahn wrote: > The 2047 * sizeof(PrimitiveInfo) is likely speculative. There is a > tradeoff between the number of reallocs (time consuming & may fragment > the heap) and the total memory consumed. The value 2047 is suitable > for character arrays, but perhaps it is not well suited to an array of > PrimitiveInfo. However, if the primitives include large polygons then > 2047 wouldn't be terribly unreasonable. > > I will look at this once I have the Windows DLL build working again. > > Bob > > On Mon, 12 Jan 2004, Wolfgang Spraul wrote: > > Bob - > > > > I noticed something strange when rendering a simple line from, let's say > > 20,20 to 600,450. > > In render.c:DrawImage(), lines 2731 to 2747 (line numbers from CVS HEAD), > > we calculate alpha, beta, radius, then length, and then check if (i >= > > (long) number_points-length)) to reallocate primitive_info to > > (number_points + length) * sizeof(PrimitiveInfo). > > In the above line example, length will be 6024. number_points (2047) - > > length will thus be negative and < i (i=2). primitive_info was already 57 > > KB long (default is 2047 * sizeof(PrimitiveInfo)), and is now supposed to > > be reallocated to 225 KB! And in the end only two entries (56 bytes) will > > actually have been used to draw the line, the other 224.95 KB were > > wasted. For now, I commented out the complete realloc block from 2731 to > > 2747. > > > > In which cases is this reallocation actually needed? > > What is the meaning of the value in the length variable (in lines 2731 to > > 2747)? > > Is the if statement (i >= (long) number_points - length) correct? > > > > Regards, > > Wolfgang > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Perforce Software. > > Perforce is the Fast Software Configuration Management System offering > > advanced branching capabilities and atomic changes on 50+ platforms. > > Free Eval! http://www.perforce.com/perforce/loadprog.html > > _______________________________________________ > > Graphicsmagick-core mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/graphicsmagick-core > > ====================================== > Bob Friesenhahn > [email protected] > http://www.simplesystems.org/users/bfriesen > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > _______________________________________________ > Graphicsmagick-core mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/graphicsmagick-core ------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html