From: Daniel J S. <dan...@ie...> - 2004-07-24 06:49:31
|
Daniel J Sebald wrote: > Ethan Merritt wrote: > >> I quite agree with you that the current setup has lots of problems. >> I thought a bit about trying to introduce explicit code to control the >> number of rows and columns. Then I looked at the code and shuddered. >> > > Now I see what you are saying. There is code for the key all over > "graphics.c". And also graph3d.c has some of the similar code replicated... not good. The "show key" may have a memory leak. There is a magic number for memory allocation: char *str = gp_alloc(30, "show_key"); and, actually, the fact the string gets pumped to stderr means there really isn't any need for "str". Anyway, the above allocation is done *every* time the routine is entered. But the free is only done conditionally on KEY_AUTO_PLACEMENT. I created a script file with "show key" repeated several times. Watching system memory, when KEY_AUTO_PLACEMENT is active, loading that file does nothing to system memory. But after "set key 30,30", calling said script file builds up system memory. Dan |