[GRASS-dev] DBF driver (severe?) memory leak
Markus Neteler
neteler at osgeo.org
Sat Apr 4 04:43:28 EDT 2009
On Sat, Apr 4, 2009 at 9:51 AM, Hamish <hamish_b at yahoo.com> wrote:
>
> Markus wrote:
>> I have tried to run r.random with vector output on a large
>> (400mega cells) raster map. After 3% of writing out the
>> vector stuff I had to cancel due to severe swapping
>> (and 4GB RAM). "top" shows that all memory is eaten by the
>> DBF driver.
...
>> Trying the same with the SQLite driver worked well,
...
> add "--trace-children=yes" to the valgrind options.
Ah, ok! So I get for the child (large losses only):
...Writing vector map <vectrandom30percent> ...
[...]
==3747== 31,560 bytes in 1 blocks are definitely lost in loss record 7 of 9
==3747== at 0x4C2136E: malloc (vg_replace_malloc.c:207)
==3747== by 0x5253135: G__realloc (alloc.c:109)
==3747== by 0x403808: add_column (column.c:48)
==3747== by 0x40627E: execute (dbfexe.c:213)
==3747== by 0x4083C3: db__driver_create_table (create_table.c:18)
==3747== by 0x4E29627: db_d_create_table (d_create_tab.c:35)
==3747== by 0x4E2ABB1: db_driver (driver.c:155)
==3747== by 0x406F09: main (main.c:47)
==3747==
==3747==
==3747== 1,526,321 bytes in 190,787 blocks are definitely lost in loss
record 8 of 9
==3747== at 0x4C2136E: malloc (vg_replace_malloc.c:207)
==3747== by 0x525303E: G__malloc (alloc.c:41)
==3747== by 0x406170: execute (dbfexe.c:139)
==3747== by 0x406952: db__driver_execute_immediate (execute.c:28)
==3747== by 0x4E29AA0: db_d_execute_immediate (d_execute.c:36)
==3747== by 0x4E2ABB1: db_driver (driver.c:155)
==3747== by 0x406F09: main (main.c:47)
==3747==
==3747==
==3747== 4,960,470 bytes in 763,149 blocks are definitely lost in loss
record 9 of 9
==3747== at 0x4C2136E: malloc (vg_replace_malloc.c:207)
==3747== by 0x61E87A1: strdup (in /lib64/libc-2.8.so)
==3747== by 0x5AD4407: yylex (lex.l:111)
==3747== by 0x5AD6C39: yyparse (y.tab.c:1469)
==3747== by 0x4058CB: execute (dbfexe.c:82)
==3747== by 0x406952: db__driver_execute_immediate (execute.c:28)
==3747== by 0x4E29AA0: db_d_execute_immediate (d_execute.c:36)
==3747== by 0x4E2ABB1: db_driver (driver.c:155)
==3747== by 0x406F09: main (main.c:47)
==3747==
==3747== LEAK SUMMARY:
==3747== definitely lost: 6,518,472 bytes in 953,941 blocks.
==3747== possibly lost: 0 bytes in 0 blocks.
==3747== still reachable: 16,826 bytes in 21 blocks.
==3747== suppressed: 0 bytes in 0 blocks.
Building topology for vector map <vectrandom30percent>
[...]
In db/drivers/dbf/dbfexe.c
I see
cols = (int *)G_malloc(ncols * sizeof(int));
but not any G_free(cols). Likewise for
set = (int *)G_malloc(aset * sizeof(int));
?
Markus
More information about the grass-dev
mailing list