Code Monkey home page Code Monkey logo

Comments (14)

lakeman avatar lakeman commented on August 12, 2024 1

Something like;

https://github.com/servalproject/serval-dna/blob/development/rhizome_database.c#L311

-  assert(!sqlite3_temp_directory);
+  if(!sqlite3_temp_directory)

https://github.com/servalproject/serval-dna/blob/development/rhizome_database.c#L488

-    assert(sqlite3_temp_directory);
-    sqlite3_free(sqlite3_temp_directory);
-    sqlite3_temp_directory = NULL;

Though this is deliberately creating a tiny memory leak.

from batphone.

lakeman avatar lakeman commented on August 12, 2024

Odd, sqlite3.c seems to define that variable twice. Try;

- SQLITE_API char *sqlite3_temp_directory;
+ SQLITE_API char *sqlite3_temp_directory = 0;

from batphone.

csam23 avatar csam23 commented on August 12, 2024

Thank you for the quick response!
My build command is now failing with the above code in sqlite3.c
error: redefinition of 'sqlite3_temp_directory'
SQLITE_API char *sqlite3_temp_directory = 0;

For my info, when I originally cloned batphone, the build command was failing due to the libsodium.a not existing issue that was solved in #127

Android NDK: ERROR:~/batphone/app/src/main/jni/opus/Android.mk:sodium: LOCAL_SRC_FILES points to a missing file  
Android NDK: Check that ~/batphone/app/src/main/jni/libsodium/libsodium-android-armv7-a/lib/libsodium.a exists or that its path is correct

However, my ndk and sdk versions are the most recent released. I think I just created libsodium.a from command terminal with gradle command which caused the build command to work.

from batphone.

lakeman avatar lakeman commented on August 12, 2024

Yeah I thought it was odd that the variable was defined twice. I'd suggest removing the second definition too. No idea why this has never failed for me.

from batphone.

csam23 avatar csam23 commented on August 12, 2024

I commented out the second definition. Build works and reinstalled onto phone. But app still stops when main menu comes up.

from batphone.

lakeman avatar lakeman commented on August 12, 2024

rhizome_database is a thread local value, but sqlite3_temp_directory is not. Is there something about the way you are using / have changed the application that might cause the database to be opened in multiple threads?

from batphone.

lakeman avatar lakeman commented on August 12, 2024

We should probably change rhizome_opendb to only set the sqlite temp folder if it has never been set, then remove the cleanup code when the database is closed.

from batphone.

csam23 avatar csam23 commented on August 12, 2024

Building the libsodium.a file from the command terminal is the only change I've made to the application thus far.

Okay, that sounds like a plan. I'm still new to the code though for implementing those changes.

from batphone.

284921310 avatar 284921310 commented on August 12, 2024

To All:
I have the same problem with this project.can anyone give me some suggest??
first of all,I meet the "libsodium.a exists or that its path is correct" problem, so I build the libsodium's sh script in terminal windows,then build is OK, but running the apk have another problem,the problem is " int rhizome_opendb(): assertion "!sqlite3_temp_directory" failed"
Now, I have no idea to deal with this problem,please give me some suggest. thx very much!

from batphone.

284921310 avatar 284921310 commented on August 12, 2024

@csam23 do you solve the problem?can you give me the method?thank you!

from batphone.

284921310 avatar 284921310 commented on August 12, 2024

by the way,my envirment is
1、vmware with ubuntu 14.04
2、NDK 18.1.5063045
3、gradle 4.4-all

from batphone.

284921310 avatar 284921310 commented on August 12, 2024

@lakeman thx a lot.now the project can be running, but i can't see the tiny memory leak's effect,maybe a lot of test can help me.

from batphone.

lakeman avatar lakeman commented on August 12, 2024

I said tiny, since the backend daemon will allocate a single string and never release it when it quits gracefully. When the backend is running within batphone, the daemon never quits.

I only mentioned it as the memory allocation will show up if anyone runs the daemon within valgrind or other automated tools that check for memory leaks.

from batphone.

lakeman avatar lakeman commented on August 12, 2024

Before I push a proper fix, I'll need to work out when to release that memory, since I sometimes run all of our automated tests using clang's memory leak detection. The false positives would annoy me...

from batphone.

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.