由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - Another R memory problem.
相关主题
请问如何在R中读入2亿多行,每行一个0.XX的分数的文件?[合集] 问个SAS和R的问题
[SAS] row merging[合集] way to do exclusive outer join by proc sql
关于proc sql left join的一个问题一个sas问题的解决方法讨论
[合集] [求助]一个生物统计工作的电话面试请教个菜鸟r code问题,一晚上也没搞明白,痛苦。。。
[合集] 怎么合并(merge)很多外部的文件?请问R Code和 Matlab Code 思路是否近似?
讲讲最近来我们公司面试的一个小姑娘吧SAS Question
HOW TO UPDATE DATA BY STRATUMHow to merge two data sets vertically using "proc sql" in sas
[合集] 讲讲最近来我们公司面试的一个小姑娘吧问一下SQL in Python。
相关话题的讨论汇总
话题: memory话题: merge话题: another话题: workspace话题: object
进入Statistics版参与讨论
1 (共1页)
f******y
发帖数: 2971
1
Sorry I cannot type Chinese now.
Two big data frame, each is approximately 1.5G.
After I merge them, this object becomes 1.7G, however memory used by R
increased 5G. I tried to release the extra memory with gc(). It does not
work. I suspect there is some cache in merge() function that holds the
memory. Is there anyway to free those memory?
I tried to quite R and save workspace, after I reopen R and load the
workspace, those memory is released. Certainly I dont want to do this from
time to time.
f******y
发帖数: 2971
2
btw, merging them does not take a very long time, just 5~10 mins.

【在 f******y 的大作中提到】
: Sorry I cannot type Chinese now.
: Two big data frame, each is approximately 1.5G.
: After I merge them, this object becomes 1.7G, however memory used by R
: increased 5G. I tried to release the extra memory with gc(). It does not
: work. I suspect there is some cache in merge() function that holds the
: memory. Is there anyway to free those memory?
: I tried to quite R and save workspace, after I reopen R and load the
: workspace, those memory is released. Certainly I dont want to do this from
: time to time.

s*****n
发帖数: 2174
3
not sure about the exact cause, but a friendly reminder that
when you merge(A, B), the object A and B are still in your memory.
so if A and B are 1.5G each, c <- merge(A, B) is 1.7G,
now 3 objects are in your workspace now.

【在 f******y 的大作中提到】
: Sorry I cannot type Chinese now.
: Two big data frame, each is approximately 1.5G.
: After I merge them, this object becomes 1.7G, however memory used by R
: increased 5G. I tried to release the extra memory with gc(). It does not
: work. I suspect there is some cache in merge() function that holds the
: memory. Is there anyway to free those memory?
: I tried to quite R and save workspace, after I reopen R and load the
: workspace, those memory is released. Certainly I dont want to do this from
: time to time.

P****D
发帖数: 11146
4
Big bull is indeed big bull...
Then is there a way to unload A and B from memory?

【在 s*****n 的大作中提到】
: not sure about the exact cause, but a friendly reminder that
: when you merge(A, B), the object A and B are still in your memory.
: so if A and B are 1.5G each, c <- merge(A, B) is 1.7G,
: now 3 objects are in your workspace now.

O*****y
发帖数: 222
5
rm(list=c("A", "B"))

【在 P****D 的大作中提到】
: Big bull is indeed big bull...
: Then is there a way to unload A and B from memory?

P****D
发帖数: 11146
6
Thanks!

【在 O*****y 的大作中提到】
: rm(list=c("A", "B"))
f******y
发帖数: 2971
7
I already did this.
my code is like:
A = merge(A, B);
rm(B);
gc();

【在 s*****n 的大作中提到】
: not sure about the exact cause, but a friendly reminder that
: when you merge(A, B), the object A and B are still in your memory.
: so if A and B are 1.5G each, c <- merge(A, B) is 1.7G,
: now 3 objects are in your workspace now.

a***d
发帖数: 336
8
I ran into this many times too..
My experience is: once R reaches Mem limit, gc() does not help much. R has
to be saved and reloaded. Do someone know how to get around this?

【在 f******y 的大作中提到】
: I already did this.
: my code is like:
: A = merge(A, B);
: rm(B);
: gc();

t*d
发帖数: 1290
9
try gc() multiple times.
if not working, get a linux.

【在 a***d 的大作中提到】
: I ran into this many times too..
: My experience is: once R reaches Mem limit, gc() does not help much. R has
: to be saved and reloaded. Do someone know how to get around this?

f******y
发帖数: 2971
10
我的就是linux,倒是没有gc很多次。不过我觉得没用。

【在 t*d 的大作中提到】
: try gc() multiple times.
: if not working, get a linux.

相关主题
讲讲最近来我们公司面试的一个小姑娘吧[合集] 问个SAS和R的问题
HOW TO UPDATE DATA BY STRATUM[合集] way to do exclusive outer join by proc sql
[合集] 讲讲最近来我们公司面试的一个小姑娘吧一个sas问题的解决方法讨论
进入Statistics版参与讨论
t*d
发帖数: 1290
11
试试吧,还是有用的。

【在 f******y 的大作中提到】
: 我的就是linux,倒是没有gc很多次。不过我觉得没用。
g********r
发帖数: 8017
12
save新object,清空所有object,gc(),load新object,行不行?
R*********r
发帖数: 225
13
这么多数据为啥不用数据库搞,处理完了再load到R里好了。

【在 f******y 的大作中提到】
: Sorry I cannot type Chinese now.
: Two big data frame, each is approximately 1.5G.
: After I merge them, this object becomes 1.7G, however memory used by R
: increased 5G. I tried to release the extra memory with gc(). It does not
: work. I suspect there is some cache in merge() function that holds the
: memory. Is there anyway to free those memory?
: I tried to quite R and save workspace, after I reopen R and load the
: workspace, those memory is released. Certainly I dont want to do this from
: time to time.

B******5
发帖数: 4676
14
嗯,这是更好的办法

【在 R*********r 的大作中提到】
: 这么多数据为啥不用数据库搞,处理完了再load到R里好了。
f******y
发帖数: 2971
15
我宁愿用C++,那种全sql的东西太难维护了。

【在 R*********r 的大作中提到】
: 这么多数据为啥不用数据库搞,处理完了再load到R里好了。
B******5
发帖数: 4676
16
没觉得C++好维护。。。

【在 f******y 的大作中提到】
: 我宁愿用C++,那种全sql的东西太难维护了。
1 (共1页)
进入Statistics版参与讨论
相关主题
问一下SQL in Python。[合集] 怎么合并(merge)很多外部的文件?
SAS data merge求助讲讲最近来我们公司面试的一个小姑娘吧
【【泪奔求助】】R高手帮我看看HOW TO UPDATE DATA BY STRATUM
怎么merge on either of the 2 ids? (sas)[合集] 讲讲最近来我们公司面试的一个小姑娘吧
请问如何在R中读入2亿多行,每行一个0.XX的分数的文件?[合集] 问个SAS和R的问题
[SAS] row merging[合集] way to do exclusive outer join by proc sql
关于proc sql left join的一个问题一个sas问题的解决方法讨论
[合集] [求助]一个生物统计工作的电话面试请教个菜鸟r code问题,一晚上也没搞明白,痛苦。。。
相关话题的讨论汇总
话题: memory话题: merge话题: another话题: workspace话题: object