[GRASS-dev] [GRASS GIS] #697: v.surf.rst memory problems

#697: v.surf.rst memory problems
-------------------------+--------------------------------------------------
Reporter: fpachecouy | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: default | Version: unspecified
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
On Ubuntu 9.04, GRASS 6.4 (from deb packeage) and GRASS 6.5 (svn).

When I run v.surf.rst with valid parameters program crash with this
output:
v.surf.rst tension=80.0 input=curvas elev=curvasMDT scolumn='cota'
segmax=100 dmin=50
Percent complete:
Reading lines from vector map ...
Reading nodes from vector map ...
  100%
  125%
*** glibc detected *** v.surf.rst: munmap_chunk(): invalid pointer:
0xb7f85e60 ***

Output (using valgrind):
valgrind v.surf.rst tension=80.0 input=curvas elev=curvasMDT
scolumn='cota' segmax=100 dmin=50

==16812== Memcheck, a memory error detector.

==16812== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.

==16812== Using LibVEX rev 1884, a library for dynamic binary translation.

==16812== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.

==16812== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation
framework.

==16812== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.

==16812== For more details, rerun with: -v

==16812==

Percent complete:

Reading lines from vector map ...
Reading nodes from vector map ...
  100%
  125%
==16812== Conditional jump or move depends on uninitialised value(s)

==16812== at 0x4055D5D: db_CatValArray_free (value.c:350)

==16812== by 0x403FF69: IL_vector_input_data_2d (vinput2d.c:305)

==16812== by 0x804C141: main (main.c:692)

==16812==

==16812== Conditional jump or move depends on uninitialised value(s)

==16812== at 0x4055D62: db_CatValArray_free (value.c:350)

==16812== by 0x403FF69: IL_vector_input_data_2d (vinput2d.c:305)

==16812== by 0x804C141: main (main.c:692)

==16812==

==16812== Conditional jump or move depends on uninitialised value(s)

==16812== at 0x4025DBD: free (vg_replace_malloc.c:323)

==16812== by 0x4055D71: db_CatValArray_free (value.c:364)

==16812== by 0x403FF69: IL_vector_input_data_2d (vinput2d.c:305)

==16812== by 0x804C141: main (main.c:692)

==16812==

==16812== Invalid free() / delete / delete

==16812== at 0x4025DFA: free (vg_replace_malloc.c:323)

==16812== by 0x4055D71: db_CatValArray_free (value.c:364)

==16812== by 0x403FF69: IL_vector_input_data_2d (vinput2d.c:305)

==16812== by 0x804C141: main (main.c:692)

==16812== Address 0x4034e60 is not stack'd, malloc'd or (recently) free'd

WARNING: strip exists with insufficient data

Thanks. Fernando.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/697&gt;
GRASS GIS <http://grass.osgeo.org>

#697: v.surf.rst memory problems
--------------------------+-------------------------------------------------
  Reporter: fpachecouy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: default | Version: unspecified
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by helena):

  * priority: major => normal

Comment:

Fernando - you are missing zcolumn for the values to be interpolated but
you are defining scolumn for the smoothing values.
I will change the priority to normal - the code should recognize the user
mistake and let him know that zcol is missing. If your data are 3D and the
value to interpolate is the z-coordinate then you need to define layer=0.
I have the code modification with -z flag instead of layer=0 for this
case, I just did not have time to submit.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/697#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#697: v.surf.rst memory problems
--------------------------+-------------------------------------------------
  Reporter: fpachecouy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: default | Version: unspecified
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by fpachecouy):

Great. It was my mistake. Sorry.

I will try to use the 3D option. Thank you very much.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/697#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

I have added some additional tests for invalid combination of parameters
to v.surf.rst (grass65) in response to #697

And as promised some time ago, I have also added the -z flag for interpolating
z-coordinates (but it will still do the same if layer=0, so any scripts that people
have should still work).
So to interpolate x,y,z data you can just run

v.surf.rst -z elev_lid792_bepts elev=test_elev3

or

v.surf.rst elev_lid792_bepts elev=test_elev3 layer=0

Please test, because I am sure there are cases that I did not think about.

Helena

Helena Mitasova
Associate Professor
Department of Marine, Earth
and Atmospheric Sciences
1125 Jordan Hall, Campus Box 8208
North Carolina State University
Raleigh NC 27695-8208
http://skagit.meas.ncsu.edu/~helena/

On Jul 24, 2009, at 1:09 AM, GRASS GIS wrote:

#697: v.surf.rst memory problems
--------------------------+-------------------------------------------------
  Reporter: fpachecouy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: default | Version: unspecified
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by helena):

  * priority: major => normal

Comment:

Fernando - you are missing zcolumn for the values to be interpolated but
you are defining scolumn for the smoothing values.
I will change the priority to normal - the code should recognize the user
mistake and let him know that zcol is missing. If your data are 3D and the
value to interpolate is the z-coordinate then you need to define layer=0.
I have the code modification with -z flag instead of layer=0 for this
case, I just did not have time to submit.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/697#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#697: v.surf.rst memory problems
--------------------------+-------------------------------------------------
  Reporter: fpachecouy | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.0
Component: default | Version: svn-develbranch6
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by helena):

  * status: new => closed
  * version: unspecified => svn-develbranch6
  * resolution: => fixed

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/697#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>