Skip to content

no decrease in memory usage after JSON::Value object goes out of scope #1542

Closed Answered by dsiddalingai
dsiddalingai asked this question in Q&A
Discussion options

You must be logged in to vote

got this reply from github copilot:


Code:

#include <fstream> 
#include "json/json.h"
#include <iostream>
#include <unistd.h>
#include <memory>
#include <vector>

using namespace std;

void qq()
{
    int z[1024*1024];

    std::string path = "stationlist.json";
    std::ifstream ifs(path);
    std::unique_ptr<Json::Value> root = std::make_unique<Json::Value>();
    Json::Reader reader;
    reader.parse(ifs, *root);
    if (ifs.is_open())
        ifs.close();

    sleep(30);
}

int main()
{
    qq();
    cout << "loop done" << endl;
    sleep(30);
    cout << "exit" << endl;

    return 0;
}

Q:
i do not see any decrease in VmRSS after exiting from qq()

A:
The behavior you're observing wi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dsiddalingai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant