I'm new to OS X so my apologies if solution to this problem is
obvious. I did try to google it first.
Any help or pointers in the right direction would be greatly appreciated.

My problem is that I am running out of memory when trying to load
1.6GB sqlite3 db from disk to :memmory: db on a computer with 4GB of
RAM.
This is on OS X 10.4.11 Intel with only Activity Monitor and iTerm
running, plus sqlite3 of course.

Schema of big_1.6GB_file.db3 is:
CREATE TABLE t1(col1 TEXT, col2 INT)
CREATE UNIQUE INDEX t1_idx1 ON t1(col1 COLLATE NOCASE)
Note that t1.col2 acts as a boolean filed, so it should take only 1
byte per row and not be very significant in overall db size.
t1 has 26985834 rows.

Here's a transcript of my sqlite3 session:

mbp:~/projects/sqlite3 chorlya$ ./sqlite3
SQLite version 3.5.4
Enter ".help" for instructions
sqlite> ATTACH "big_1.6GB_file.db3" AS atch;
sqlite> CREATE TABLE t1(col1 TEXT);
sqlite> INSERT INTO t1 SELECT col1 FROM atch.t1;
sqlite> DETACH atch;
sqlite> CREATE UNIQUE INDEX t1_idx1 ON t1(col1 COLLATE NOCASE);
sqlite3(7782) malloc: *** vm_allocate(size=8421376) failed (error code=3)
sqlite3(7782) malloc: *** error: can't allocate region
sqlite3(7782) malloc: *** set a breakpoint in szone_error to debug
sqlite3(7782) malloc: *** vm_allocate(size=8421376) failed (error code=3)
sqlite3(7782) malloc: *** error: can't allocate region
sqlite3(7782) malloc: *** set a breakpoint in szone_error to debug
SQL error: out of memory
sqlite>

At this point Activity Monitor shows Real memory: 1.74 Virtual memory:
1.76 for sqlite3 process, and 423MB of free memory.
I tried sqlite3-3.5.4-osx-x86.bin from sqlite website and compiled my
own from source, and result is same in both cases.
I should also mention that I'm successfully doing this exact same
thing with same db on windows machine with 1.75GB of RAM. It does hit
the swap, but it works without any problems.


Thanks

-- 
Nemanja Čorlija <[EMAIL PROTECTED]>

Reply via email to