[Rd] A question on R memory management in .Fortran() calls under Windows
Duncan Murdoch
murdoch at stats.uwo.ca
Mon Sep 12 13:40:14 CEST 2005
Simone Giannerini wrote:
> Dear Duncan and Simon,
>
> many thanks for your helpful reply.
>
>
>>Duncan Murdoch wrote:
>>It looks as though your Fortran compiler is allocating the new matrix on
>>the stack. R doesn't give you a huge stack, and that's causing the
>>overflow. When you get R to do the allocation, it does it on the heap,
>>which has no artificial limits. Only a pointer to the object ends up on
>>the stack.
>
>
> yes, CVF allocates automatic objects on the stack and apparently there
> is no way of changing it. By the way, increasing the stack of the
> fortran process when linking does not solve the problem
>
>
>>I'd say your only reasonable workarounds are to tell your compiler to
>>use the heap for the local matrix allocation (if that's possible), or do
>>your allocations in R.
>
>
> I might follow the second way, in any case, I am considering switching
> to Linux, I have also considered changing compiler under Win, any
> suggestions on the choice would be welcomed.
I think it's far from the best optimizing compiler, but the Fortran that
comes with MinGW (g77 currently in Windows) is the one used to build R,
so it's the one that will is most likely to work with it without
fiddling. But I don't use Fortran, so I don't know what else is available.
Duncan Murdoch
More information about the R-devel
mailing list