Romolo:

I feel like:
  #do some calculation on r and write it with same name
Might be the culprit.  What calculation were you doing?  Can you paste in
the code?  Creating a raster and writing a raster take almost no memory
AFAIK.

Also, your code shows the looping through the length of fileAnno, but I
don't see that defined anywhere.

--j


On Thu, Feb 7, 2013 at 2:22 AM, Romolo Salini <salinir@tiscali.it> wrote:

> Dear R-sig-geo,
> I'm looping the function "writeRaster", as in:
>
> fileDisp=list.files(getwd(),full=TRUE)
> for (f in 1:length(fileAnno))
>   {
>   r=raster(fileDisp[f])
>   #do some calculation on r and write it with same name
>   writeRaster(r,filename=fileDisp[f],format="GTiff",overwrite=TRUE)
>   }
>
> After about 10/15 iterations, R quits.
> As it seemed to be a memory allocation problem, I tried adding (uselessly):
>
> rm(r)
> Sys.sleep(5)
>
> Does anybody had the same problem?
>
> > sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252
> [3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
> [5] LC_TIME=Italian_Italy.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> Sys.info()
>                      sysname                      release
>                    "Windows"                         "XP"
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Jonathan A. Greenberg, PhD
Assistant Professor
Global Environmental Analysis and Remote Sensing (GEARS) Laboratory
Department of Geography and Geographic Information Science
University of Illinois at Urbana-Champaign
607 South Mathews Avenue, MC 150
Urbana, IL 61801
Phone: 217-300-1924
http://www.geog.illinois.edu/~jgrn/
AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307, Skype: jgrn3007

	[[alternative HTML version deleted]]

