Fossil

Diff
Login

Differences From Artifact [9a3cc502aa]:

To Artifact [ae9317b099]:


445
446
447
448
449
450
451


























445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
  }else{
    sqlite3_open("",&db);
  }
  sqlite3_file_control(db, 0, SQLITE_FCNTL_TEMPFILENAME, (void*)&zTFile);
  if( g.db==0 ) sqlite3_close(db);
  return zTFile;
}

/*
** Limit the total amount of memory available to Fossil
*/
void fossil_limit_memory(sqlite3_int64 nHeap, sqlite3_int64 nStack){
#if defined(__unix__)
  struct rlimit x;

#if defined(RLIMIT_DATA)
  getrlimit(RLIMIT_DATA, &x);
  if( sizeof(x.rlim_cur)<8 && nHeap>0x7fffffff ){
    nHeap = 0x7fffffff;
  }
  x.rlim_cur = (rlim_t)nHeap;
  setrlimit(RLIMIT_DATA, &x);
#endif /* defined(RLIMIT_DATA) */
#if defined(RLIMIT_STACK)
  getrlimit(RLIMIT_STACK, &x);
  if( sizeof(x.rlim_cur)<8 && nStack>0x7fffffff ){
    nStack = 0x7fffffff;
  }
  x.rlim_cur = (rlim_t)nStack;
  setrlimit(RLIMIT_STACK, &x);
#endif /* defined(RLIMIT_STACK) */
#endif /* defined(__unix__) */
}