Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#736 closed defect (fixed)

r.proj fails in wingrass

Reported by: cnielsen Owned by: grass-dev@…
Priority: normal Milestone: 6.4.0
Component: Raster Version: unspecified
Keywords: r.proj, wingrass Cc:
CPU: x86-32 Platform: MSWindows Vista

Description

Reported in: http://www.mail-archive.com/grass-user@lists.osgeo.org/msg09983.html and http://n2.nabble.com/r-proj-exe-has-stopped-working-td3500149.html#a3500149

I tried this with latest standalone and osgeo4w versions with the same result. "r.proj.exe has stopped working". I also tried r.proj.old with the same result.

By adding a couple debug lines I found out it is crashing on line 280

pj_print_proj_params(&iproj, &oproj);

Not sure what this means but hopefully someone else does. g.proj -w works fine but it could still be a PROJ.4 issue.

-Colin

Change History (13)

comment:1 by hamish, 15 years ago

Keywords: r.proj wingrass added

comment:2 by hamish, 15 years ago

As is the case once again with these wingrass bugs, valgrind finds some memory errors which are apparently benign on UNIX.

setup:

#get&set region
spearfish> g.region -dbg
#
#create and enter a LL/WGS84 location
ll_wgs84> g.region n=44.50173527 s=44.37032007 \
            w=-103.87110972 e=-103.62942673 res=0:00:01 -ap

ll_wgs84> CMD="r.proj in=elevation.dem loc=spearfish60 mapset=PERMANENT"
ll_wgs84> valgrind --tool=memcheck --leak-check=yes --show-reachable=yes $CMD

result: (GRASS 6.5svn on Debian/Etch 32bit i686 linux)

==5114== Memcheck, a memory error detector.
==5114== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==5114== Using LibVEX rev 1658, a library for dynamic binary translation.
==5114== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==5114== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework.
==5114== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==5114== For more details, rerun with: -v
==5114== 
Input Projection Parameters:  +proj=utm +zone=13 +a=6378206.4 +rf=294.9786982 +no_defs +nadgrids=$GISBASE/etc/nad/conus
Input Unit Factor: 1
Output Projection Parameters:  +proj=longlat +a=6378137 +rf=298.257223563 +no_defs +towgs84=0.000,0.000,0.000
Output Unit Factor: 1

Input:
Cols: 633 (633)
Rows: 466 (466)
North: 4928000.000000 (4928000.000000)
South: 4914020.000000 (4914020.000000)
West: 590010.000000 (590010.000000)
East: 609000.000000 (609000.000000)
EW-res: 30.000000
NS-res: 30.000000

Output:
Cols: 868 (871)
Rows: 462 (474)
North: 44.501667 (44.501944)
South: 44.373333 (44.370278)
West: -103.870556 (-103.871111)
East: -103.629444 (-103.629167)
EW-res: 0.000278
NS-res: 0.000278

Allocating memory and reading input map...
==5114== Syscall param write(buf) points to uninitialised byte(s)
==5114==    at 0x4000792: (within /lib/ld-2.3.6.so)
==5114==    by 0x804BF58: main (main.c:391)
==5114==  Address 0x6366A0C is 2,532 bytes inside a block of size 163,840 alloc'd
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4037B8D: G__malloc (alloc.c:41)
==5114==    by 0x804C7D7: readcell (readcell.c:68)
==5114==    by 0x804BF58: main (main.c:391)
 100%
Projecting...
 100%
==5114== 
==5114== Invalid read of size 4
==5114==    at 0x4010DE9: (within /lib/ld-2.3.6.so)
==5114==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==5114==    by 0x4006792: (within /lib/ld-2.3.6.so)
==5114==    by 0x479246F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E8BF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47704E5: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==  Address 0x6361B3C is 36 bytes inside a block of size 38 alloc'd
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==5114==    by 0x479246F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E8BF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47704E5: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471EB6E: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114== 
==5114== Conditional jump or move depends on uninitialised value(s)
==5114==    at 0x4008ED5: (within /lib/ld-2.3.6.so)
==5114==    by 0x47928C4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E8BF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47704E5: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471EB6E: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471E499: getpwuid (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114== 
==5114== Conditional jump or move depends on uninitialised value(s)
==5114==    at 0x4008B2E: (within /lib/ld-2.3.6.so)
==5114==    by 0x47928C4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E8BF: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47704E5: __nss_passwd_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471EB6E: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471E499: getpwuid (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114== 
==5114== Invalid read of size 4
==5114==    at 0x4010DD3: (within /lib/ld-2.3.6.so)
==5114==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==5114==    by 0x4006792: (within /lib/ld-2.3.6.so)
==5114==    by 0x479246F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x6468169: (within /lib/tls/i686/cmov/libnss_compat-2.3.6.so)
==5114==    by 0x646928C: _nss_compat_getpwuid_r (in /lib/tls/i686/cmov/libnss_compat-2.3.6.so)
==5114==  Address 0x6392C18 is 32 bytes inside a block of size 35 alloc'd
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==5114==    by 0x479246F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x6468169: (within /lib/tls/i686/cmov/libnss_compat-2.3.6.so)
==5114==    by 0x646928C: _nss_compat_getpwuid_r (in /lib/tls/i686/cmov/libnss_compat-2.3.6.so)
==5114==    by 0x471EA94: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114== 
==5114== Invalid read of size 4
==5114==    at 0x4010DE9: (within /lib/ld-2.3.6.so)
==5114==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==5114==    by 0x4006792: (within /lib/ld-2.3.6.so)
==5114==    by 0x400A1F6: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x400A3CA: (within /lib/ld-2.3.6.so)
==5114==    by 0x47924D4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==  Address 0x6361FCC is 36 bytes inside a block of size 37 alloc'd
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==5114==    by 0x400A1F6: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x400A3CA: (within /lib/ld-2.3.6.so)
==5114==    by 0x47924D4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x4791EDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x47946FC: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==5114==    by 0x479475D: __libc_dlopen_mode (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E7CF: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
r.proj complete.
==5114== 
==5114== ERROR SUMMARY: 521 errors from 6 contexts (suppressed: 107 from 1)
==5114== malloc/free: in use at exit: 897,236 bytes in 217 blocks.
==5114== malloc/free: 1,756 allocs, 1,539 frees, 1,195,737 bytes allocated.
==5114== For counts of detected errors, rerun with: -v
==5114== searching for pointers to 217 not-freed blocks.
==5114== checked 2,934,108 bytes.
==5114== 
==5114== 
==5114== 1 bytes in 1 blocks are still reachable in loss record 1 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x565226F: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 1 bytes in 1 blocks are still reachable in loss record 2 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x56721DF: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 8 bytes in 1 blocks are still reachable in loss record 3 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x5686C5D: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 16 bytes in 1 blocks are still reachable in loss record 4 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x5629523: geos::GeometryFactory::GeometryFactory() (in /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x562425A: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 16 bytes in 1 blocks are still reachable in loss record 5 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x5624250: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 24 bytes in 1 blocks are still reachable in loss record 6 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x56A0DEF: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 28 bytes in 1 blocks are still reachable in loss record 7 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x566001F: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 40 bytes in 5 blocks are indirectly lost in loss record 8 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x476E5CD: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x6468187: ???
==5114==    by 0x646928C: ???
==5114==    by 0x471EA94: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471E499: getpwuid (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x4072CDC: G_whoami (whoami.c:70)
==5114==    by 0x4050B98: G_short_history (history.c:207)
==5114==    by 0x403D48C: close_new (closecell.c:311)
==5114==    by 0x403CBD7: G_close_cell (closecell.c:81)
==5114==    by 0x804C2BF: main (main.c:448)
==5114== 
==5114== 
==5114== 80 bytes in 5 blocks are indirectly lost in loss record 9 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x475B84B: tsearch (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476E58E: __nss_lookup_function (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x6468169: ???
==5114==    by 0x646928C: ???
==5114==    by 0x471EA94: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471E499: getpwuid (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x4072CDC: G_whoami (whoami.c:70)
==5114==    by 0x4050B98: G_short_history (history.c:207)
==5114==    by 0x403D48C: close_new (closecell.c:311)
==5114==    by 0x403CBD7: G_close_cell (closecell.c:81)
==5114==    by 0x804C2BF: main (main.c:448)
==5114== 
==5114== 
==5114== 140 bytes in 2 blocks are still reachable in loss record 10 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x46FD17F: strdup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x40E322C: pj_gridinfo_init (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40E431A: (within /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40E44D4: pj_gridlist_from_nadgrids (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40E07B4: pj_apply_gridshift (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40E1B35: pj_datum_transform (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40E1E1C: pj_transform (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x4024146: pj_do_proj (do_proj.c:84)
==5114==    by 0x804A055: bordwalk (bordwalk.c:56)
==5114==    by 0x804BB8C: main (main.c:309)
==5114== 
==5114== 
==5114== 156 (36 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x476EA09: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x476F0F6: __nss_database_lookup (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x6468149: ???
==5114==    by 0x646928C: ???
==5114==    by 0x471EA94: getpwuid_r (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x471E499: getpwuid (in /lib/tls/i686/cmov/libc-2.3.6.so)
==5114==    by 0x4072CDC: G_whoami (whoami.c:70)
==5114==    by 0x4050B98: G_short_history (history.c:207)
==5114==    by 0x403D48C: close_new (closecell.c:311)
==5114==    by 0x403CBD7: G_close_cell (closecell.c:81)
==5114==    by 0x804C2BF: main (main.c:448)
==5114== 
==5114== 
==5114== 256 bytes in 1 blocks are still reachable in loss record 12 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x56721F3: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 256 bytes in 1 blocks are still reachable in loss record 13 of 19
==5114==    at 0x401DB31: operator new(unsigned) (vg_replace_malloc.c:163)
==5114==    by 0x5686C3F: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x56A1F04: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x5617938: (within /usr/lib/libgeos.so.2.2.3)
==5114==    by 0x400B7F4: (within /lib/ld-2.3.6.so)
==5114==    by 0x400B920: (within /lib/ld-2.3.6.so)
==5114==    by 0x40007EE: (within /lib/ld-2.3.6.so)
==5114== 
==5114== 
==5114== 853 bytes in 80 blocks are definitely lost in loss record 14 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4037B8D: G__malloc (alloc.c:41)
==5114==    by 0x405418E: G__location_path (location.c:80)
==5114==    by 0x405409E: G_location_path (location.c:41)
==5114==    by 0x404F7E4: G__gisinit (gisinit.c:58)
==5114==    by 0x804B443: main (main.c:134)
==5114== 
==5114== 
==5114== 6,696 bytes in 5 blocks are still reachable in loss record 15 of 19
==5114==    at 0x401C6CA: calloc (vg_replace_malloc.c:279)
==5114==    by 0x4037C00: G__calloc (alloc.c:74)
==5114==    by 0x405A4EC: G_parser (parser.c:762)
==5114==    by 0x804B638: main (main.c:202)
==5114== 
==5114== 
==5114== 11,776 bytes in 1 blocks are still reachable in loss record 16 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4037C6C: G__realloc (alloc.c:109)
==5114==    by 0x4057680: new_fileinfo (opencell.c:42)
==5114==    by 0x4057B2A: G__open_cell_old (opencell.c:274)
==5114==    by 0x4057740: G_open_cell_old (opencell.c:104)
==5114==    by 0x804BF26: main (main.c:389)
==5114== 
==5114== 
==5114== 20,191 bytes in 7 blocks are still reachable in loss record 17 of 19
==5114==    at 0x401D487: realloc (vg_replace_malloc.c:306)
==5114==    by 0x4037C83: G__realloc (alloc.c:111)
==5114==    by 0x4046128: set_env (env.c:156)
==5114==    by 0x404683A: G__setenv (env.c:391)
==5114==    by 0x405953D: G_check_overwrite (overwrite.c:65)
==5114==    by 0x804B621: main (main.c:200)
==5114== 
==5114== 
==5114== 265,380 bytes in 19 blocks are still reachable in loss record 18 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x40DE25D: pj_malloc (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40DEECF: pj_mkparam (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x40DD441: pj_init (in /usr/lib/libproj.so.0.5.4)
==5114==    by 0x402373F: pj_get_kv (get_proj.c:228)
==5114==    by 0x804B82D: main (main.c:234)
==5114== 
==5114== 
==5114== 591,438 bytes in 83 blocks are still reachable in loss record 19 of 19
==5114==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==5114==    by 0x4037B8D: G__malloc (alloc.c:41)
==5114==    by 0x406E110: G_store (store.c:36)
==5114==    by 0x4062D0C: G_set_program_name (progrm_nme.c:52)
==5114==    by 0x404F79C: G__gisinit (gisinit.c:51)
==5114==    by 0x804B443: main (main.c:134)
==5114== 
==5114== LEAK SUMMARY:
==5114==    definitely lost: 889 bytes in 81 blocks.
==5114==    indirectly lost: 120 bytes in 10 blocks.
==5114==      possibly lost: 0 bytes in 0 blocks.
==5114==    still reachable: 896,227 bytes in 126 blocks.
==5114==         suppressed: 0 bytes in 0 blocks.

Hamish

in reply to:  description ; comment:3 by jef, 15 years ago

Replying to cnielsen:

By adding a couple debug lines I found out it is crashing on line 280

> pj_print_proj_params(&iproj, &oproj);

pj_print_proj_params() uses G_free() to free a string returned from PROJ, where it should use pj_free().

in reply to:  3 ; comment:4 by glynn, 15 years ago

Replying to jef:

pj_print_proj_params() uses G_free() to free a string returned from PROJ, where it should use pj_free().

Fixed in r38873 (7.0).

in reply to:  4 comment:5 by martinl, 15 years ago

Replying to glynn:

Replying to jef:

pj_print_proj_params() uses G_free() to free a string returned from PROJ, where it should use pj_free().

Fixed in r38873 (7.0).

Backported in r38874 (6.5) and r38875 (6.4).

comment:6 by cnielsen, 15 years ago

Not fixed yet. Same error comes up after update. It prints the "Input Projection Parameters" which is the line above the now pj_free, but hangs at pj_free line 405 of get_proj.c

in reply to:  6 ; comment:7 by jef, 15 years ago

Replying to cnielsen:

Not fixed yet. Same error comes up after update. It prints the "Input Projection Parameters" which is the line above the now pj_free, but hangs at pj_free line 405 of get_proj.c

Ouch. It's not pj_free(), it's pj_dalloc() (just like in #537). Sorry.

in reply to:  7 comment:8 by jef, 15 years ago

Replying to jef:

Ouch. It's not pj_free(), it's pj_dalloc() (just like in #537). Sorry.

And #468. How embarassing - sorry again.

comment:9 by hamish, 15 years ago

jef:

Ouch. It's not pj_free(), it's pj_dalloc()

so, does the patch test out ok & shall we commit it?

Index: lib/proj/get_proj.c
===================================================================
--- lib/proj/get_proj.c (revision 38897)
+++ lib/proj/get_proj.c (working copy)
@@ -402,7 +402,7 @@
        if (str != NULL) {
            fprintf(stderr, "%s: %s\n", _("Input Projection Parameters"),
                    str);
-           pj_free(str);
+           pj_dalloc(str);
            fprintf(stderr, "%s: %.16g\n", _("Input Unit Factor"),
                    iproj->meters);
        }
@@ -415,7 +415,7 @@
        if (str != NULL) {
            fprintf(stderr, "%s: %s\n", _("Output Projection Parameters"),
                    str);
-           pj_free(str);
+           pj_dalloc(str);
            fprintf(stderr, "%s: %.16g\n", _("Output Unit Factor"),
                    oproj->meters);
        }

thanks, Hamish

in reply to:  9 comment:10 by glynn, 15 years ago

Replying to hamish:

Ouch. It's not pj_free(), it's pj_dalloc()

Ouch. I can't be the only person to have been tripped up by that one.

Any chance of getting the PROJ developers to rename pj_free() to e.g. pj_free_proj()?

so, does the patch test out ok & shall we commit it?

Yes.

comment:11 by cnielsen, 15 years ago

Works on winGrass. Commit it.

comment:12 by hamish, 15 years ago

Resolution: fixed
Status: newclosed

Ok guys, patch submitted on all branches. Thanks!

Glynn:

Ouch. I can't be the only person to have been tripped up by that one. Any chance of getting the PROJ developers to rename pj_free() to e.g. pj_free_proj()?

I think you'll have to take that up with them directly.

Hamish

ps- I still would like to learn a bit more about how to deal with there errors which Valgrind finds; leaving them there but ignoring them seems like an unscratched itch. Currently I can make the reports but it's frustrating having done that not knowing what to do next.

in reply to:  12 comment:13 by jef, 15 years ago

Replying to hamish:

ps- I still would like to learn a bit more about how to deal with there errors which Valgrind finds; leaving them there but ignoring them seems like an unscratched itch. Currently I can make the reports but it's frustrating having done that not knowing what to do next.

Without reviewing the valgrind log in detail, I'd just expect memory leaks. Those just waste memory and are otherwise harmless, unless you run out of memory because of them.

It didn't point to the crash. Actually it can't as there isn't any problem valgrind could detect, because on Unix there isn't any. On Unix the runtime library (aka libc) provides malloc() and free() and deals with memory management for the whole process - including shared libraries.

On Windows OTOH each DLL can have it's own runtime library and each call to malloc() must be matched with a call to free() from the same library. Therefore each DLL provides a function to free allocated memory they return, that simply calls free(), but from the runtime library they use - eg. pj_dalloc() for PROJ, CPLFree() for GDAL/OGR and G_free() for GRASS).

Still you won't run into problems if you compile everything using the same runtime library, eg. one version of MinGW.

On Unix one could also call any of those or free() directly, without causing problems. But one still shouldn't as the functions might do more than just free() in the future. That's also why I'd consider those issues bugs even on Unix.

Note: See TracTickets for help on using tickets.