Git Product home page Git Product logo

Comments (11)

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024

Also noticing:

unsafe {
        sqlite3_soft_heap_limit64(1024);
        let soft_limit = sqlite3_soft_heap_limit64(-1);
        sqlite3_hard_heap_limit64(1024);
        let hard_limit = sqlite3_hard_heap_limit64(-1);
        println!("Soft limit: {} hard limit: {}", soft_limit, hard_limit);
    }
Soft limit: 1024 hard limit: 0

from rusqlite.

gwenn avatar gwenn commented on July 18, 2024

Are you sure that it is related to rusqlite ?
What happens if you use only C or any other language bindings ?

from rusqlite.

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024
conn.pragma_update(
        Some(rusqlite::DatabaseName::Main),
        "hard_heap_limit",
        rusqlite::types::Value::Integer(1024),
    )?;
    conn.pragma_query(Some(rusqlite::DatabaseName::Main),
    "hard_heap_limit", |row | -> Result<()> {
        println!("hard heap limit pragma: {:?}", row);
        Ok(())
    }).unwrap();

also returns

hard heap limit pragma: {Ok("hard_heap_limit"): (Integer, 0)}

from rusqlite.

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024

@gwenn I've just checked the SQLite cli on macOS:

 dangoodman: ~/code/learningRust/sqlite-test git:(main) ✗ sqlite3                                                                                          9:35AM
SQLite version 3.43.2 2023-10-10 13:08:14
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> PRAGMA hard_heap_limit;
0
sqlite> PRAGMA hard_heap_limit = 1024;
0
sqlite> PRAGMA hard_heap_limit;
0
sqlite> PRAGMA hard_heap_limit=1024;
0
sqlite> PRAGMA hard_heap_limit;
0
sqlite>

I assume this is compiled with the defaults which should allow it to be enabled as well

Seeing similar behavior with soft heap limits as the code:

sqlite> PRAGMA soft_heap_limit;
0
sqlite> PRAGMA soft_heap_limit=1024;
1024
sqlite> PRAGMA soft_heap_limit;
1024

from rusqlite.

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024

Curious that it can't see it's own memory usage though as well no? All the checks and build flags indicate that this should be available. I'm not familiar with how to quickly test in another language that has such low level bindings to SQLite.

from rusqlite.

gwenn avatar gwenn commented on July 18, 2024

In case you don't know, you can ask for help here:
https://sqlite.org/forum/forum
but mainly for "official" projects or "general" questions related to SQLite.

from rusqlite.

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024

Thanks, I wasn’t sure how much this might have been related to the build flags or any other config that might have been crate specific

from rusqlite.

gwenn avatar gwenn commented on July 18, 2024

You can use bundled feature temporarily if you are not sure of the flags used by your system library.

rusqlite = {version = "0.31.0", features = ["hooks", "bundled"]}

from rusqlite.

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024

Will this use the flags from the crate build.rs?

from rusqlite.

gwenn avatar gwenn commented on July 18, 2024

Yes, these ones:

cfg.file(format!("{lib_name}/sqlite3.c"))
.flag("-DSQLITE_CORE")
.flag("-DSQLITE_DEFAULT_FOREIGN_KEYS=1")
.flag("-DSQLITE_ENABLE_API_ARMOR")
.flag("-DSQLITE_ENABLE_COLUMN_METADATA")
.flag("-DSQLITE_ENABLE_DBSTAT_VTAB")
.flag("-DSQLITE_ENABLE_FTS3")
.flag("-DSQLITE_ENABLE_FTS3_PARENTHESIS")
.flag("-DSQLITE_ENABLE_FTS5")
.flag("-DSQLITE_ENABLE_JSON1")
.flag("-DSQLITE_ENABLE_LOAD_EXTENSION=1")
.flag("-DSQLITE_ENABLE_MEMORY_MANAGEMENT")
.flag("-DSQLITE_ENABLE_RTREE")
.flag("-DSQLITE_ENABLE_STAT2")
.flag("-DSQLITE_ENABLE_STAT4")
.flag("-DSQLITE_SOUNDEX")
.flag("-DSQLITE_THREADSAFE=1")
.flag("-DSQLITE_USE_URI")
.flag("-DHAVE_USLEEP=1")
.flag("-D_POSIX_THREAD_SAFE_FUNCTIONS") // cross compile with MinGW

from rusqlite.

danthegoodman1 avatar danthegoodman1 commented on July 18, 2024

@gwenn thanks for the help, testing with a GH codespace using the provided sqlite I got:

config mem status enabled
Memory tracking is enabled. Current memory usage: 16168 bytes, Highwater mark: 16184 bytes
PRAGMA soft_heap_limit set to 1024
soft_heap_limit pragma: {Ok("soft_heap_limit"): (Integer, 1024)}
PRAGMA hard_heap_limit set to 1024
Error: SqliteFailure(Error { code: OutOfMemory, extended_code: 7 }, Some("out of memory"))

I assume bundling would also perform the same.

It seems the issue was my local version of sqlite on macOS!

from rusqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.