![](/img/trans.png)
[英]Memory allocation error trying to create a map with eurostat package with R
[英]htmlParse() segfault error in R XML package: 'memory not mapped'
我正在使用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
這個問題似乎也做了saveXML()
在htmlParse()
文件。
當我寫另一個使用htmlParse()
代碼時,我不記得遇到過這個問題(雖然我不記得我是否明確調用了htmlParse()
對象)。 所以我不完全確定這是否是最近的問題。 當時和現在(我記得)的唯一區別是我從源代碼安裝了許多OmegaHat軟件包 。
我很好奇,如果有其他人得到這個錯誤。 為了探究我的筆記本電腦是否存在原因,我已經重新啟動並升級了我的操作系統作為基本步驟。 可能是什么問題? 謝謝。
編輯 :僅供參考:
> 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
我認為,幾乎按照定義,分段錯誤構成了一個錯誤。 你的例子對我有用(見下文)。
我會(a)確保你有最新版本的XML,並且錯誤仍然存在; (b)聯系XML包的維護者(試試
維護者(“XML”))並提供您的示例和sessionInfo()的結果
祝好運。
=============
library(XML)a < - htmlParse(“ http://bm2.genes.nig.ac.jp/RGM2/R_current/library/XML/man/xmlTreeParse.html ”)
sessionInfo()R版本2.11.1(2010-05-31)i486-pc-linux-gnu
locale:[1] LC_CTYPE = en_US.UTF-8 LC_NUMERIC = C.
[3] LC_TIME = en_US.UTF-8 LC_COLLATE = en_US.UTF-8
[5] LC_MONETARY = C LC_MESSAGES = en_US.UTF-8
[7] LC_PAPER = en_US.UTF-8 LC_NAME = C.
[9] LC_ADDRESS = C LC_TELEPHONE = C.
[11] LC_MEASUREMENT = en_US.UTF-8 LC_IDENTIFICATION = C.
附加基礎包:[1] stats graphics grDevices utils數據集網格方法
[8]基地
其他附件包:[1] XML_3.1-0 reshape_0.8.3 plyr_1.0.3 proto_0.3-8
通過命名空間加載(而不是附加):[1] ggplot2_0.8.8
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.