Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Scott Robison
On Aug 31, 2016 5:29 AM, "sanhua.zh" wrote: > > BTW, what do you think if I mapseparatly instead of the whole db file, ... I suspect that it wouldn't really help you much, if any. One, there is overhead in making that many system calls to map a bunch of 4 MiB buffers.

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Simon Slavin
On 31 Aug 2016, at 12:28pm, sanhua.zh wrote: > BTW, what do you think if I mapseparatly instead of the whole db file, which > is the way I mentioned before ? Sorry but I have no experience with that. I hope other people can advise you. Simon.

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread sanhua.zh
things. BTW, what do you think if I mapseparatly instead of the whole db file, which is the way I mentioned before ? 原始邮件 发件人:Simon slavinslav...@bigfraud.org 收件人:SQLite mailing listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年8月31日(周三) 18:04 主题:Re: [sqlite] Why MMAP return ENOMEM in SQLite

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Simon Slavin
On 31 Aug 2016, at 9:39am, sanhua.zh wrote: > Yes. even on iDevice, [mmap] can get faster than sequential I/O. Sometime it > will be twice faster. Unless your users have complained about speed, this does not matter. There is no need to make everything happen as fast

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread sanhua.zh
OK, I get your idea. Thanks for your advice. :) 原始邮件 发件人:Stephan bealsgb...@googlemail.com 收件人:SQLite mailing listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年8月31日(周三) 17:09 主题:Re: [sqlite] Why MMAP return ENOMEM in SQLite? On Wed, Aug 31, 2016 at 11:03 AM, sanhua.zh sanhua...@foxmail.com

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Stephan Beal
On Wed, Aug 31, 2016 at 11:03 AM, sanhua.zh wrote: > Why do you think it will corrupt the database? > Can you give me more explainations or examples? > It's only my intuition - i don't have a concrete example. sqlite and ios are "well-oiled machines." They do their jobs

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread sanhua.zh
Why do you think it will corrupt the database? Can you give me more explainations or examples? 原始邮件 发件人:Stephan bealsgb...@googlemail.com 收件人:SQLite mailing listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年8月31日(周三) 16:57 主题:Re: [sqlite] Why MMAP return ENOMEM in SQLite? On Wed, Aug 31

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Stephan Beal
On Wed, Aug 31, 2016 at 10:55 AM, sanhua.zh wrote: > Yes, [mmap] can be larger than physical memory. > Indeed, my mistake. > And what do you think about the new mapping way I mentioned ? > i think it's a "huge can of worms" - it's asking for more, bigger problems than

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread sanhua.zh
Yes, [mmap] can be larger than physical memory. And what do you think about the new mapping way I mentioned ? 原始邮件 发件人:Stephan bealsgb...@googlemail.com 收件人:SQLite mailing listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年8月31日(周三) 16:53 主题:Re: [sqlite] Why MMAP return ENOMEM in SQLite

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Stephan Beal
On Wed, Aug 31, 2016 at 10:43 AM, Stephan Beal wrote: > On Wed, Aug 31, 2016 at 10:39 AM, sanhua.zh wrote: > >> In my testcase, I can only [mmap] a db file at most 1.4GB size. But in >> this new way, I can map a file at most 3.2GB. The test device

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Stephan Beal
On Wed, Aug 31, 2016 at 10:39 AM, sanhua.zh wrote: > In my testcase, I can only [mmap] a db file at most 1.4GB size. But in > this new way, I can map a file at most 3.2GB. The test device is iPhone 6S. > According to google, the iPhone 6s only has 2GB of RAM, so you can't

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread sanhua.zh
listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年8月31日(周三) 16:39 主题:Re: [sqlite] Why MMAP return ENOMEM in SQLite? Thanks for your answer. Simon Why are you trying to do memory-mapping on a portable device ? Is it for speed ? Do you absolutely need it ? Yes. even on iDevice, [mmap] can get

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread sanhua.zh
listsqlite-us...@mailinglists.sqlite.org 发送时间:2016年8月31日(周三) 14:38 主题:Re: [sqlite] Why MMAP return ENOMEM in SQLite? On 31 Aug 2016, at 4:40am, sanhua.zh sanhua...@foxmail.com wrote: Is it caused by mmap file too big that the address space is not enough? Yes. Under iOS, memory maps can only

Re: [sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-31 Thread Simon Slavin
On 31 Aug 2016, at 4:40am, sanhua.zh wrote: > Is it caused by mmap file too big that the address space is not enough? Yes. Under iOS, memory maps can only be as big as the available physical memory. You're working on a tiny multi-tasking device and memory is at a

[sqlite] Why MMAP return ENOMEM in SQLite?

2016-08-30 Thread sanhua.zh
I try to mmap a BIG file which is around 1.8GB size, on iOS. Then I found that [sqlite3OSFetch] doesn’t work at all, which means the mmap is disable. After debug, I find that [osMmap] in [unixRemapFile] return an error. The error code is 12, named ENOMEM, which means cannot allocate memory. My