Giter VIP home page Giter VIP logo

Comments (4)

gbowne1 avatar gbowne1 commented on August 21, 2024

The memory leak could be fixed with

std::map<std::string, std::string&> DataFrame::operator[](size_t index) {
    std::map<std::string, std::string&> series;
    for (auto& col : this->data) {
        series[col.first] = col.second.at(index);
    }
    return series;
}

from gradebook-management-system.

andrewlod avatar andrewlod commented on August 21, 2024

Hey!

Are you sure it is a memory leak? As far as I remember, when I designed the DataFrame, I did not allocate any memory (and when I do, it is via smart pointers). I have tried returning a reference instead of a pointer, but it returned some error I don't remember (I have gone through this though: https://stackoverflow.com/questions/1543193/why-cant-i-store-references-in-a-stdmap-in-c). Also, it is a non-owning pointer, meant to be used as a reference.

Did you try running it with Valgrind and see if it reports anything?

I will address some of these issues and fix them when I get some time!

from gradebook-management-system.

andrewlod avatar andrewlod commented on August 21, 2024

std::endl probably should be \n

The reason I used std::endl instead of \n was because it flushes the output buffer, while \n does not. (https://www.geeksforgeeks.org/endl-vs-n-in-cpp/).

from gradebook-management-system.

gbowne1 avatar gbowne1 commented on August 21, 2024

I really need to get into Valgrind testing this and I haven't so far yet. Fair enough for using endl for that. Just some thoughts I had. Just did some objective debugging on this looking for small things that could cause issues. My big problem is with the operator[].. just needs more debugging and testing.

Do the sizeRows and sizeCols seem inconsistent?

I think the code overall is pretty good.

from gradebook-management-system.

Related Issues (11)

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.