Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
Am I hitting artificial QSqlDatabase limits?

I have a function which has been working well for ages, which begins

QSqlDatabase
DBUtil :: basic_open (const QString & path)
{
    static int connection_num = 0;
    static const QString CONNECTION_NAME = "Connection%1";

    QSqlDatabase db = QSqlDatabase :: addDatabase (
        "QSQLITE",
        CONNECTION_NAME .arg (connection_num++));

    db .setDatabaseName (path);

    if (false == db .open ())
    {
         // error

I am using this to open and read from many small SQLite databases, each ~200k, and when opening the 1013th one it fails with

 out of memory Error opening database

The total application's memory load is ~200M, with gigabytes free on the machine.

It seems like I'm hitting a limit other than sheer memory. Each QSqlDatabase object goes out of loop scope before the next is created, these databases aren't all existing concurrently, and I can't see any connection limits mentioned in the documentation. So I'm confused.

lsof reports about 200 open file handles before this loop starts and about 1,200 when it finishes, so it looks like Qt is keeping the handles open after ~QSqlDatabase, but still, if that's the limit it seems a bit low.

Any idea what's going on? This is on up-to-date Ubuntu.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

First of all - QSqlDatabase is a singleton, so scope doesn't matter.

Try to close connection before opening new one.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda