On 12-02-03 9:26 AM, Grigory Alexandrovich wrote:
Hi,

I wrote a C-function which I call with the .C-interface  ( something
like .C("foo", x, y) ).
The function does a lot of things.
Among<http://dict.leo.org/ende?lp=ende&p=_xpAA&search=things&trestr=0x8004>st
other things it allocates much memory (stack and heap).
Every heap allocation (with malloc) has a corresponding free call.

My problem is, that if I call this function many times in a for-loop,
the memory amount used by R
converges to 100% and the process is being killed at the end.

Clearing the workspace doesn't help, since the memory is not occupied by
R-objects.

Is it a known problem with the .C interface? How can I found out what
kind of data fills the memory and especially how can I clean it?

The .C() function will create duplicate copies of its arguments, but they aren't saved, so garbage collection should reclaim them. So it's most likely a problem in your own C code. Debugging those is hard.

Duncan Murdoch


I work on Linux (OpenSuse 12.1)

Thanks

Grigory Alexandrovich





        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

______________________________________________
R-help@r-project.org 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.

Reply via email to