[GRASS5] Re: r.sun improvements
Paul Kelly
paul-grass at stjohnspoint.co.uk
Thu Apr 10 04:41:55 EDT 2003
Hello Jaro and Hamish
On Thu, 10 Apr 2003, Jaro Hofierka wrote:
>
> However, there is another problem with memory associated with proj
> library. If you have latitude defined via region settings (i.e. you
> don't define lat and latin options) then memory usage is unbelievably
> high. I guess it is some memory allocation/freeing problem in proj
> library. I have used proj library functions to get latitude/longitute
> for each ratser cell using examples from grass programmers manual. I
I didn't realise r.sun calls the proj functions so often. Maybe it needs
to free the memory used for the key/value pairs read from the PROJ_INFO
file. Does the patch below help? I don't use r.sun so can't really test
it. When I have time I mean to update the example in the programmer's manual.
Paul
Index: main.c
===================================================================
RCS file: /grassrepository/grass/src/raster/r.sun/main.c,v
retrieving revision 1.11
diff -u -r1.11 main.c
--- main.c 7 Apr 2003 15:15:20 -0000 1.11
+++ main.c 10 Apr 2003 08:28:22 -0000
@@ -1463,6 +1463,11 @@
if (pj_get_kv(&oproj, out_proj_info, out_unit_info) < 0)
G_fatal_error("Unable to set up lat/long projection parameters");
+ G_free_key_value( in_proj_info );
+ G_free_key_value( in_unit_info );
+ G_free_key_value( out_proj_info );
+ G_free_key_value( out_unit_info );
+
if(pj_do_proj(&longitude,&latitude,&iproj,&oproj) < 0)
{
fprintf(stderr,"Error in pj_do_proj\n");
More information about the grass-dev
mailing list