View Ticket
Not logged in
Ticket UUID: 992a62361d745f9c3007deed2ed11a9858907dee
Title: mmap_size cannot be greater than 2GB even on 64 bit system
Status: Closed Type: Feature_Request
Severity: Minor Priority: Medium
Subsystem: Native_Assembly Resolution: Works_As_Designed
Last Modified: 2016-03-30 04:41:35
Version Found In: 1.0.99
User Comments:
anonymous added on 2016-02-24 13:17:17: (text/x-fossil-plain)
Setting mmap_size always gets clipped at 2 GiB even on a 64 bit system:

if ( Environment.Is64BitProcess )
	cmd.CommandText = $"PRAGMA mmap_size={(long)Math.Pow(2, 36)}; PRAGMA mmap_size;";
	var result = Convert.ToInt64(cmd.ExecuteScalar());
	const double GiB = 1024 * 1024 * 1024;
	Console.WriteLine("64-bit-SQLite memory mapped page size has been set to: {0:n1} GiB", result / GiB);

Since there is nearly unlimited address space on a 64 bit system there should not be such a low limit. There are no problems (I successfully tested it) in mapping a 10 TB file into a single memory block on a system which only has 1GB (=0.001 TB) of physical RAM.

mistachkin added on 2016-02-25 01:05:40: (text/x-fossil-plain)
You can always recompile the SQLite interop assembly with a higher value for
SQLITE_MAX_MMAP_SIZE.  Currently, System.Data.SQLite uses the default value
for this option, which is 0x7fff0000 (as of 3.11).