[mapserver-commits] r12891 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Tue Dec 13 11:59:20 EST 2011


Author: tbonfort
Date: 2011-12-13 08:59:20 -0800 (Tue, 13 Dec 2011)
New Revision: 12891

Modified:
   trunk/mapserver/mapcache/src/imageio_jpeg.c
Log:
use malloc instead of pools for large mem operations


Modified: trunk/mapserver/mapcache/src/imageio_jpeg.c
===================================================================
--- trunk/mapserver/mapcache/src/imageio_jpeg.c	2011-12-13 11:11:57 UTC (rev 12890)
+++ trunk/mapserver/mapcache/src/imageio_jpeg.c	2011-12-13 16:59:20 UTC (rev 12891)
@@ -237,7 +237,8 @@
       img->stride = img->w * 4;
    }
 
-   temp = apr_pcalloc(r->pool,img->w*s);
+   temp = malloc(img->w*s);
+   apr_pool_cleanup_register(r->pool, temp, (void*)free, apr_pool_cleanup_null) ;
    while ((int)cinfo.output_scanline < img->h)
    {
       int i;
@@ -302,7 +303,7 @@
    if(GC_HAS_ERROR(ctx)) {
       return NULL;
    }
-   empty->data = (unsigned char*)apr_pcalloc(pool,width*height*4*sizeof(unsigned char)); 
+   empty->data = malloc(width*height*4*sizeof(unsigned char)); 
    for(i=0;i<width*height;i++) {
       ((unsigned int*)empty->data)[i] = color;
    }
@@ -312,6 +313,7 @@
 
    buf = format->write(ctx,empty,format);
    apr_pool_destroy(pool);
+   free(empty->data);
    return buf;
 }
 



More information about the mapserver-commits mailing list