Re: waste of RAM/bug in render.c?
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <Pine.GSO.4.44.0401121028400.29988-100000@scooby.simplesystems.org> |
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