[GRASS-dev] [bug #5264] (grass) v.digit - G_malloc out of memory error

Hamish hamish_nospam at yahoo.com
Mon Nov 13 00:02:50 EST 2006


 [ http://intevation.de/rt/webrt?serial_num=5264 ]
> v.digit -n map=testv2
> New empty map created.
> ERROR: G_malloc: out of memory


Maciej Sieczka wrote:
> Hamish wrote:
> 
> > can this be reproduced with a realistic region size?
> > 
> > (I'm not saying it isn't something that shouldn't be looked into,
> > but I'm not too worried about GRASS failing gracefully when the user
> > has defined a region bigger than their system can handle, ~ 100,000
> > x 100,000 cells (40gb?))
> 
> By setting the region (no matter how big) you don't create any "40 GB
> data". And you don't create any such huge dataset either by running
> 'v.digit -n test' and drawing a line. IOW, there is no reason v.digit
> should crash in the given circumstances.

shouldn't .. and yet it does.


fwiw,

grass63/vector/v.digit$ grep G_malloc *
cat.c:    MaxFieldCat = (void *) G_malloc ( (aMaxFieldCat) * sizeof(int) * 2 ); 
symb.c:    LineSymb = (int *) G_malloc ( (aLineSymb + 1) * sizeof(int) );
symb.c:    NodeSymb = (int *) G_malloc ( (aNodeSymb + 1) * sizeof(int) );


you'd have to run it through the debugger to find which G_malloc call is
the guilty one. (or if it's from another lib fn call external to
v.digit)


for me, I can set the res this fine before it crashes: (spearfish)

# v.digit still works
G63> g.region res=0.0002 -p
nsres:      0.0002
ewres:      0.0002
rows:       69900000
cols:       94950000
cells:      6637005000000000

#v.digit crashes
G63> g.region res=0.0001 -p
..
nsres:      0.0001
ewres:      0.0001
rows:       139800000
cols:       189900000
cells:      26548020000000000


after that setting res back to 10m doesn't help. I always get the error
until restarting GRASS. I guess the # of cells is overflowing into a
static variable? or more probably just generally breaking the
G_get_window() & co calls ??

again, these region settings are totally unrealistic, but cleaning up
after bogus region settings shouldn't break the entire grass session.


Hamish




More information about the grass-dev mailing list