【发布时间】:2011-03-23 19:05:56
【问题描述】:
我正在使用 R 2.11.1 和 XML 包 3.1-0,当我遇到段错误错误时,我正在查看来自 R2GoogleMaps 的示例。
#library(RJSONIO)
library(R2GoogleMaps)
library(XML)
#library(RCurl)
load("b.rda") # find in the sampleDocs folder in source file of R2GoogleMaps
center = c(mean(range(b$lat)), mean(range(b$long)))
code = addOverlay(gpolyline(b))
d = googleMapsDoc(code, center, zoom = 11, dim = c(750, 700), file = "simplePolyline.html")
下面是一个容易重现的代码,它得到了同样的错误:
> library(XML)
> a <- htmlParse("http://bm2.genes.nig.ac.jp/RGM2/R_current/library/XML/man/xmlTreeParse.html")
> a
*** caught segfault ***
address 0x55aa44, cause 'memory not mapped'
Traceback:
1: .Call("RS_XML_dumpHTMLDoc", doc, as.integer(indent), as.character(encoding), as.logical(indent), PACKAGE = "XML")
2: saveXML(from)
3: saveXML(from)
4: asMethod(object)
5: as(x, "character")
6: cat(as(x, "character"), "\n")
7: print.XMLInternalDocument(<pointer: 0x1016363f0>)
8: print(<pointer: 0x1016363f0>)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
aborting ...
Process R segmentation fault at Sat Jul 31 22:07:02 2010
问题似乎还在于对htmlParse() 文件执行saveXML()。
当我编写另一个使用htmlParse() 的代码时,我不记得曾经遇到过这个问题(尽管我不记得我是否明确调用了htmlParse() 对象)。所以我不完全确定这是否是最近的问题。当时和现在的唯一区别(我记得)是我从源代码安装了许多OmegaHat packages。
我很好奇是否有其他人收到此错误。为了探究原因是否与我的笔记本电脑有关,我已经重新启动并升级了我的操作系统作为基本步骤。可能是什么问题?谢谢。
编辑:仅供参考:
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-apple-darwin9.8.0
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets grid methods
[8] base
other attached packages:
[1] XML_3.1-0 digest_0.4.2 reshape_0.8.3 plyr_0.1.9 proto_0.3-8
loaded via a namespace (and not attached):
[1] ggplot2_0.8.7
【问题讨论】:
标签: memory r segmentation-fault html-parsing