[R] Seg. faults in mapthin (in package maps!)

Kevin Bartz kbartz at loyaltymatrix.com
Thu Jul 1 19:18:36 CEST 2004

Dr. Ripley, you are the master. That fix worked like a charm! All the way to
50, with no problems. Thanks again,


-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Thursday, July 01, 2004 10:07 AM
To: Kevin Bartz
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Seg. faults in mapthin (in package maps!)

You are on a 64-bit architecture and the C interface is declared as

void mapthin(x, y, n, delta, symmetric)
     double *x, *y, *delta;
     long *n, *symmetric;

R's integer type is int, not long, but they are the same on a 32-bit 

I am pretty sure that changing long to int will fix this.

There are a few other quirks, and I would check some of the other uses of 
`long' in the C sources.

On Thu, 1 Jul 2004, Kevin Bartz wrote:

> Hi everyone! I know segmentation faults are awfully hard to diagnose, but
> I'm experiencing a fairly regular pattern of seg. faults when plotting
> map in the maps package. Starting R fresh, I run:
> require(maps)
> for (i in 1:50) {
>   cat(i, "\n")
>   map("state")
> }
> I always get the same result:
> 1 
> 2 
> 3 
> 4 
> 5 
> Process R segmentation fault at Thu Jul  1 09:07:39 2004
> With some browsering, I've zeroed in on the source of the segmentation
> fault: map's call to mapthin. Funny thing is, when I comment out the call
> mapthin, everything works consistently, without a hitch, and with no
> apparent difference in the map.
> Still, I'd rather work with the package the way it was built. I must be
> losing something by cutting out the call to mapthin. 
> I was wondering if anyone has any ideas. I've never had a segmentation
> before on this particular machine, but these few lines always produce the
> same unfortunate result. Has anyone else experienced segmentation faults
> plotting using map in the maps package? Is there any way I might rectify
> I'm on SuSE Linux, by the way, with:
> > version
>          _                       
> platform x86_64-unknown-linux-gnu
> arch     x86_64                  
> os       linux-gnu               
> system   x86_64, linux-gnu       
> status   alpha                   
> major    1                       
> minor    9.1                     
> year     2004                    
> month    06                      
> day      13                      
> language R                       
> Thanks for any help you can provide,
> Kevin
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list