Bug 14372 - memory.limit with values greater than 4095
Summary: memory.limit with values greater than 4095
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R 2.12.0
Hardware: ix86 (32-bit) Windows 64-bit
: P5 normal
Assignee: R-core
Depends on:
Reported: 2010-08-31 20:32 UTC by Stephan Wahlbrink
Modified: 2015-12-14 13:48 UTC (History)
1 user (show)

See Also:

Patch (447 bytes, text/plain)
2010-08-31 20:32 UTC, Stephan Wahlbrink

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Wahlbrink 2010-08-31 20:32:58 UTC
Created attachment 1124 [details]

It seems there is a small bug in memory.limit on the win64 builds. It prevents to set the memory limit to values greater than 4095 during an R session:

> memory.limit()
[1] 3891
> memory.limit(4000)
[1] 4000
> memory.limit(4095)
[1] 4095
> memory.limit(4096)
[1] 4095
Warning message:
In memory.size(size) : cannot decrease memory limit: ignored

> sessionInfo()
R version 2.11.1 Patched (2010-08-17 r52771) / 2.12.0 trunk svn52852
Platform: x86_64-pc-mingw32/x64 (64-bit)

I guess the type of the variable newmax in the associated C function
SEXP do_memsize(SEXP call, SEXP op, SEXP args, SEXP rho)
is not yet adapted for 64bit compatibility? Changing it to R_size_t fixes the issue for me (see patch).

Comment 1 Duncan Murdoch 2010-09-10 00:44:15 UTC
Thanks for the patch, I'll put it in.