#863: set_env/unset_env should release memory
--------------------------+-------------------------------------------------
  Reporter:  rblazek      |       Owner:  [email protected]
      Type:  enhancement  |      Status:  new                      
  Priority:  normal       |   Milestone:  6.5.0                    
 Component:  libgis       |     Version:  svn-trunk                
Resolution:               |    Keywords:                           
  Platform:  All          |         Cpu:  Unspecified              
--------------------------+-------------------------------------------------
Comment (by glynn):

 Replying to [comment:3 rblazek]:
 > GRASS modules probably don't set variables repeatedly, but in GDAL, for
 example, if working with GRASS rasters from more mapsets/locations
 simultaneously, needs to reset mapset/location if masking is not disabled.
 It is using G_set_window() which checks for MASK.
 >
 > Is there any other reasonable way how to reset environment when reading
 rasters from more mapsets/locations?

 If you need to switch between two distinct environments (e.g. source and
 destination), there's G!__create_alt_env() and G!__switch_env().

 If you need more than two environments, you're out of luck.

 Changing this would mean that many library functions calling G_getenv()
 etc would need to free the memory when it's no longer needed, which means
 that they would need to either track when it's no longer needed or push
 this burden onto the caller.

 In large software packages, tracking dynamically-allocated memory can be a
 major issue. Eliminating this issue is one of the main "selling points" of
 high-level languages with built-in garbage collection.

 The GRASS philosophy of not worrying about memory leaks which will only
 occur a few times per process (for a normal GRASS module) saves us a
 '''lot''' of trouble.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/863#comment:4>
GRASS GIS <http://grass.osgeo.org>
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to