The R Project SVN R

Rev

Rev 71308 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71308 Rev 71676
Line 647... Line 647...
647
/* R Specific declarations here */
647
/* R Specific declarations here */
648
 
648
 
649
extern size_t R_max_memory;
649
extern size_t R_max_memory;
650
extern int R_Is_Running;
650
extern int R_Is_Running;
651
static size_t R_used = 0;
651
static size_t R_used = 0;
652
void Rf_warning(const char *, ...);
-
 
653
 
652
 
654
#if !ONLY_MSPACES
653
#if !ONLY_MSPACES
655
 
654
 
656
/* ------------------- Declarations of public routines ------------------- */
655
/* ------------------- Declarations of public routines ------------------- */
657
 
656
 
Line 1334... Line 1333...
1334
/* Win32 MMAP via VirtualAlloc */
1333
/* Win32 MMAP via VirtualAlloc */
1335
static void* win32mmap(size_t size) {
1334
static void* win32mmap(size_t size) {
1336
  void* ptr;
1335
  void* ptr;
1337
  /* printf("current %0.1f, asking %0.1f\n", R_used/1048576., size/1048576.);*/
1336
  /* printf("current %0.1f, asking %0.1f\n", R_used/1048576., size/1048576.);*/
1338
  if (R_used + size > R_max_memory) {
1337
  if (R_used + size > R_max_memory) {
1339
      if(R_Is_Running) 
-
 
1340
	  Rf_warning("Reached total allocation of %dMb: see help(memory.size)",
-
 
1341
		     R_max_memory/1048576);
-
 
1342
      return MFAIL;
1338
      return MFAIL;
1343
  }
1339
  }
1344
  ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
1340
  ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
1345
  R_used += (ptr != 0)? size: 0;
1341
  R_used += (ptr != 0)? size: 0;
1346
  return (ptr != 0)? ptr: MFAIL;
1342
  return (ptr != 0)? ptr: MFAIL;
Line 1349... Line 1345...
1349
/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
1345
/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */
1350
static void* win32direct_mmap(size_t size) {
1346
static void* win32direct_mmap(size_t size) {
1351
  void* ptr;
1347
  void* ptr;
1352
  /* printf("current %0.1f, asking %0.1f\n", R_used/1048576., size/1048576.);*/
1348
  /* printf("current %0.1f, asking %0.1f\n", R_used/1048576., size/1048576.);*/
1353
  if (R_used + size > R_max_memory) {
1349
  if (R_used + size > R_max_memory) {
1354
      if(R_Is_Running) 
-
 
1355
	  Rf_warning("Reached total allocation of %dMb: see help(memory.size)",
-
 
1356
		     R_max_memory/1048576);
-
 
1357
      return MFAIL;
1350
      return MFAIL;
1358
  }
1351
  }
1359
  ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
1352
  ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN,
1360
                           PAGE_READWRITE);
1353
                           PAGE_READWRITE);
1361
  R_used += (ptr != 0)? size: 0;
1354
  R_used += (ptr != 0)? size: 0;