Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8225611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:28:14+00:00 2026-06-07T15:28:14+00:00

I just started to use Valgrind to check a C++ application for memory leaks.

  • 0

I just started to use Valgrind to check a C++ application for memory leaks. But every time the program tries to open an Sqlite3 database it terminates with a SIGSEGV. This does not happen when it is run without Valgrind.

The simplest program to demonstrate this is as follows

int main (int argc, char** argv) {
    sqlite3 *db = 0;
    sqlite3_open("/tmp/mydb.sqlite", &db);
    return 0;
}

Valgrind reports:

==29227== Jump to the invalid address stated on the next line
==29227==    at 0x0: ???
==29227==    by 0x48C606: mallocWithAlarm (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x477F71: sqlite3Malloc (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x4BD7F5: pthreadMutexAlloc (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x47740F: sqlite3_initialize (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x48929D: openDatabase (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x10014B507: main (in /usr/local/bin/outbound)
==29227==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==29227== 
==29227== 
==29227== Process terminating with default action of signal 11 (SIGSEGV)
==29227==  Bad permissions for mapped region at address 0x0
==29227==    at 0x0: ???
==29227==    by 0x48C606: mallocWithAlarm (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x477F71: sqlite3Malloc (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x4BD7F5: pthreadMutexAlloc (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x47740F: sqlite3_initialize (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x48929D: openDatabase (in /opt/local/lib/libsqlite3.0.8.6.dylib)
==29227==    by 0x10014B507: main (in /usr/local/bin/outbound)

What may cause this behaviour in Valgrind?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:28:15+00:00Added an answer on June 7, 2026 at 3:28 pm

    Try using a single HEAP object passed into sqlite3.

    sqlite3_config (SQLITE_CONFIG_HEAP, malloc (1024*1024), 1024*1024, 64);
    

    This allocates 1 MB of data, from a single “malloc” that valgrind will be happy with, with a minimum allocation size of 64 bytes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started learning to use valgrind and the --tool=memcheck But what I am
I just started to use SQL Server 2008. I have a winforms application that
I just started to use Guice. When I am using Guice my application classes
I've just started to use PHPUnit, but I've run into a bit of a
I just started to use JSTL for my project, but sorry to say it's
I'm a fairly experienced Java user, but I've just started trying to use NetBeans
I've just started to use Partials in my rails application, at the moment i
I have just started using XML as I usually use php but I am
I just started learning how to use Task in C#. But I've encountered a
Just started to use Mercurial. Wow, nice application. I moved my database file out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.