hello everybody,
I have some code which looks like:
dyn.load("lpSolve.so")
res <- lp(some.parameters)
and everything runs fine.
What lp() does, it's just calling a C function which is in "lpSolve.so"
If I call lp() a large number of times:
for(1 in 1:5000){
gc(verbose=TRUE)
res <- lp(some.parameters)
}
then gc() is showing that the memory used by R process remain almost constant
all the time. But the system memory used is going up _very fast_ and the above
code never succeed because the memory used rich the limit.
>From this I'm drawing the conclusion that there is some memory leak on the C
>code called by lp() which gc() cannot report since this is a C process.
Does all this makes any sense or I'm wrong?
The next thing I tried was
for(1 in 1:5000){
gc(verbose=TRUE)
dyn.load("lpSolve.so")
res <- lp(some.parameters)
dyn.unload("lpSolve.so")
}
But the problem is still there. The memory used is going up really fast.
Now my other question is: When I call dyn.unload() doesnt it terminate the
previous C process? Next time in the loop, a new C process starts, and I will
not have any problem with memory.
Any comment is very much appreciated,
Thank you ,
Johan
P.S. lpSolve.so above is from package "lpSolve". I thought that getting
"lpSolve.so" and doing the above trick will solve my problem, but I have been
surely wrong.
---------------------------------
See the all-new, redesigned Yahoo.com. Check it out.
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.