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 6628323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:07:03+00:00 2026-05-25T22:07:03+00:00

I am using a serializer in QT C++. It looks ok but valgrind (memcheck

  • 0

I am using a serializer in QT C++. It looks ok but valgrind (memcheck tool) is reporting a memory leak on this function.

Valgrind cmd: valgrind --tool=memcheck --leak-check=full

QDataStream &operator>>( QDataStream &in, QList<AppNodeRecord *> *objAppNodeListRecord)
{
    quint32 len;
    in >> len;

    objAppNodeListRecord->clear();
    for(quint32 i = 0; i < len; ++i)
    {
        AppNodeRecord *tmp=new AppNodeRecord;
        in >> tmp;
        objAppNodeListRecord->append(tmp);

        if (in.atEnd())
            break;
    }
    return in;
}

Valgrind reports that this instance is not freed but it is been used in the QList.

AppNodeRecord *tmp=new AppNodeRecord;

Valgrind output:

==19503== 1,445 (68 direct, 1,377 indirect) bytes in 1 blocks are definitely lost in loss record 1,540 of 1,568
==19503==    at 0x4026351: operator new(unsigned int) (vg_replace_malloc.c:255)
==19503==    by 0x8058562: operator>>(QDataStream&, QList<AppNodeRecord*>*) (zbDbs_NodeMgmt.cpp:206)
==19503==    by 0x804D53C: main (main.cpp:53)

Could it be a valgrind issue?

  • 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-05-25T22:07:04+00:00Added an answer on May 25, 2026 at 10:07 pm

    The QList isn’t responsible for deallocating the AppNodeRecord pointers you append to it, you have to do it manually (qDeleteAll might help in that case).

    But as usual, for lack of a good reason, use QList<AppNodeRecord> to avoid this hassle in the first place.

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

Sidebar

Related Questions

I was using the xml serializer but when I switched to binary serialization, it
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
While using this code to serialize an object: public object Clone() { var serializer
Using C# and .Net 4.0 I have a generated schema that looks like this:
I am using the XML serializer. I would like it to convert all my
I'm looking to create a crash-proof NSDictionary as I'm using a JSON serializer that
I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts
I've serialized an object using Newtonsoft's JSON serializer, and the DateTime has come through
I'm using DataContractSerializer to serialize/deserialize my classes to/from XML. Everything works fine, but at
var store = GetStore(); using (IsolatedStorageFileStream fileStream = store.OpenFile(RootData, FileMode.Create)) { DataContractSerializer serializer =

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.