[GRASS-dev] r.univar, ERROR G_realloc:

Pietro peter.zamb at gmail.com
Thu Dec 5 17:40:08 PST 2013


Dear developers,

I tried to use r,univar in grass7 (r58395 on linux 64bit with 24Gb of
ram and 8Gb of swap), before to run the command I did a distclean, and
I configured with:

CFLAGS="-ggdb -Wall -Werror-implicit-function-declaration" ./configure ...

when I run:

r.univar map=Combabula_Nearmap.red zones=seg005_64_zones
percentile=90. output=red.csv -e --o

The module termanate with:

D1/1: G_find_raster(): name=MASK mapset=pietro
Current region rows: 28545, cols: 27645
ERROR: G_realloc: unable to allocate 68000 bytes of memory at
       r.univar_main.c:327


Any idea?

Maybe is a stupid idea but since I had some problems also with
v.build, do you think that could be possible that the problem is due
not to the GRASS code, but to my physical memory that maybe is damaged
in some sector?
A damaged ram can lead to this result?


However, using gdb, I got:


G70> gdb `which r.univar`

GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/r.univar...done.


(gdb) run map=Combabula_Nearmap.red zones=seg005_64_zones
percentile=90. output=red.csv -e --o

Starting program:
/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/r.univar
map=Combabula_Nearmap.red zones=seg005_64_zones percentile=90.
output=red.csv -e --o
warning: no loadable sections found in added symbol-file
system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
D1/1: G_find_raster2(): name=seg005_64_zones mapset=
D1/1: G_find_raster2(): name=seg005_64_zones mapset=
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster(): name=MASK mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster(): name=MASK mapset=pietro
Current region rows: 28545, cols: 27645
ERROR: G_realloc: unable to allocate 68000 bytes of memory at
       r.univar_main.c:327

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff72ed3d9 in raise () from /usr/lib/libc.so.6



(gdb) bt full

#0  0x00007ffff72ed3d9 in raise () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff798603d in G_fatal_error (
    msg=0x7ffff799f668 "G_realloc: unable to allocate %lu bytes of
memory at %s:%d") at error.c:169
        busy = 1
        ap = {{gp_offset = 32, fp_offset = 48,
            overflow_arg_area = 0x7fffffffd7e0,
            reg_save_area = 0x7fffffffd720}}
#2  0x00007ffff7982180 in G__realloc (file=0x405f4e "r.univar_main.c",
    line=327, buf=0x0, n=68000) at alloc.c:135
        window = {format = 0, compressed = -1, rows = 28545, rows3 = 28545,
          cols = 27645, cols3 = 27645, depths = 1, proj = 1, zone = -55,
          ew_res = 0.52619081800000067, ew_res3 = 0.52619081999999995,
          ns_res = 0.52619081799999301, ns_res3 = 0.52619081999999995,
          tb_res = 1, north = 7104206.8011954101, south = 7089186.6842956003,
          east = 759827.49500820006, west = 745280.94984459004, top = 1,
          bottom = 0}
#3  0x00000000004023cf in process_raster (stats=0x7fffe17c4010, fd=1, fdz=0,
    region=0x7fffffffd970) at r.univar_main.c:327
        msize = 68000
        val = 129
        zone = 2400960
        ptr = 0x5b5b374
        zptr = 0x5b76374
        col = 24149
        rows = 28545
        cols = 27645
        map_type = 0
        value_sz = 4
        row = 24693
        raster_row = 0x5b43a20
        zoneraster_row = 0x5b5ea20
        n_zones = 2774561
#4  0x0000000000401e3f in main (argc=7, argv=0x7fffffffdb38)
    at r.univar_main.c:190
        rasters = 1
        region = {format = 0, compressed = -1, rows = 28545, rows3 = 28545,
          cols = 27645, cols3 = 27645, depths = 1, proj = 1, zone = -55,
          ew_res = 0.52619081800000067, ew_res3 = 0.52619081999999995,
          ns_res = 0.52619081799999301, ns_res3 = 0.52619081999999995,
          tb_res = 1, north = 7104206.8011954101, south = 7089186.6842956003,
          east = 759827.49500820006, west = 745280.94984459004, top = 1,
          bottom = 0}
        module = 0x7ffff7babd08 <state+40>
        stats = 0x7fffe17c4010
        p = 0x609b80
        z = 0x609ac0 "seg005_64_zones"
        fd = 1
        fdz = 0
        cell_type = 0
        min = 1
        max = 2774561
        zone_range = {min = 1, max = 2774561, first_time = 0}
        mapset = 0x60a320 "pietro"
        name = 0x609b60 "red.csv"
        map_type = 0
        __PRETTY_FUNCTION__ = "main"


As suggested by MarkusM in another thread, I set:

G70> export GRASS_VECTOR_LOWMEM=1


and then again with gdb:

G70> gdb `which r.univar`

GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/r.univar...done.


(gdb) run map=Combabula_Nearmap.red zones=seg005_64_zones
percentile=90. output=red.csv -e --o

Starting program:
/home/pietro/docdat/src/gis/grass/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/r.univar
map=Combabula_Nearmap.red zones=seg005_64_zones percentile=90.
output=red.csv -e --o
warning: no loadable sections found in added symbol-file
system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
D1/1: G_find_raster2(): name=seg005_64_zones mapset=
D1/1: G_find_raster2(): name=seg005_64_zones mapset=
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster(): name=MASK mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=seg005_64_zones mapset=pietro
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster2(): name=Combabula_Nearmap.red mapset=PERMANENT
D1/1: G_find_raster(): name=MASK mapset=pietro
Current region rows: 28545, cols: 27645
ERROR: G_realloc: unable to allocate 68000 bytes of memory at
       r.univar_main.c:327

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff72ed3d9 in raise () from /usr/lib/libc.so.6


(gdb) bt full

#0  0x00007ffff72ed3d9 in raise () from /usr/lib/libc.so.6
No symbol table info available.
#1  0x00007ffff798603d in G_fatal_error (
    msg=0x7ffff799f668 "G_realloc: unable to allocate %lu bytes of
memory at %s:%d") at error.c:169
        busy = 1
        ap = {{gp_offset = 32, fp_offset = 48,
            overflow_arg_area = 0x7fffffffd7d0,
            reg_save_area = 0x7fffffffd710}}
#2  0x00007ffff7982180 in G__realloc (file=0x405f4e "r.univar_main.c",
    line=327, buf=0x0, n=68000) at alloc.c:135
        window = {format = 0, compressed = -1, rows = 28545, rows3 = 28545,
          cols = 27645, cols3 = 27645, depths = 1, proj = 1, zone = -55,
          ew_res = 0.52619081800000067, ew_res3 = 0.52619081999999995,
          ns_res = 0.52619081799999301, ns_res3 = 0.52619081999999995,
          tb_res = 1, north = 7104206.8011954101, south = 7089186.6842956003,
          east = 759827.49500820006, west = 745280.94984459004, top = 1,
          bottom = 0}
#3  0x00000000004023cf in process_raster (stats=0x7fffe17c4010, fd=1, fdz=0,
    region=0x7fffffffd960) at r.univar_main.c:327
        msize = 68000
        val = 129
        zone = 2400960
        ptr = 0x5b5b374
        zptr = 0x5b76374
        col = 24149
        rows = 28545
        cols = 27645
        map_type = 0
        value_sz = 4
        row = 24693
        raster_row = 0x5b43a20
        zoneraster_row = 0x5b5ea20
        n_zones = 2774561
#4  0x0000000000401e3f in main (argc=7, argv=0x7fffffffdb28)
    at r.univar_main.c:190
        rasters = 1
        region = {format = 0, compressed = -1, rows = 28545, rows3 = 28545,
          cols = 27645, cols3 = 27645, depths = 1, proj = 1, zone = -55,
          ew_res = 0.52619081800000067, ew_res3 = 0.52619081999999995,
          ns_res = 0.52619081799999301, ns_res3 = 0.52619081999999995,
          tb_res = 1, north = 7104206.8011954101, south = 7089186.6842956003,
          east = 759827.49500820006, west = 745280.94984459004, top = 1,
          bottom = 0}
        module = 0x7ffff7babd08 <state+40>
        stats = 0x7fffe17c4010
        p = 0x609b80
        z = 0x609ac0 "seg005_64_zones"
        fd = 1
        fdz = 0
        cell_type = 0
        min = 1
        max = 2774561
        zone_range = {min = 1, max = 2774561, first_time = 0}
        mapset = 0x60a320 "pietro"
        name = 0x609b60 "red.csv"
        map_type = 0
        __PRETTY_FUNCTION__ = "main"


More information about the grass-dev mailing list