# HG changeset patch # User Sebastien Jodogne # Date 1720269082 -7200 # Node ID ebcbb448bea87635e09becc15fc0e434887a7c73 # Parent e300f22a46f0b4b1b569d4a0eec024dffb540226 improved memory diff -r e300f22a46f0 -r ebcbb448bea8 OrthancServer/Sources/Database/FindResponse.cpp --- a/OrthancServer/Sources/Database/FindResponse.cpp Sat Jul 06 14:24:45 2024 +0200 +++ b/OrthancServer/Sources/Database/FindResponse.cpp Sat Jul 06 14:31:22 2024 +0200 @@ -142,6 +142,22 @@ } + FindResponse::ChildrenInformation::~ChildrenInformation() + { + for (MetadataValues::iterator it = metadataValues_.begin(); it != metadataValues_.end(); ++it) + { + assert(it->second != NULL); + delete it->second; + } + + for (MainDicomTagValues::iterator it = mainDicomTagValues_.begin(); it != mainDicomTagValues_.end(); ++it) + { + assert(it->second != NULL); + delete it->second; + } + } + + void FindResponse::ChildrenInformation::AddIdentifier(const std::string& identifier) { if (identifiers_.find(identifier) == identifiers_.end()) @@ -164,11 +180,12 @@ { std::set s; s.insert(value); - metadataValues_[metadata] = s; + metadataValues_[metadata] = new std::set(s); } else { - found->second.insert(value); + assert(found->second != NULL); + found->second->insert(value); } } @@ -184,7 +201,8 @@ } else { - values = found->second; + assert(found->second != NULL); + values = *found->second; } } @@ -198,11 +216,12 @@ { std::set s; s.insert(value); - mainDicomTagValues_[tag] = s; + mainDicomTagValues_[tag] = new std::set(s); } else { - found->second.insert(value); + assert(found->second != NULL); + found->second->insert(value); } } @@ -218,7 +237,8 @@ } else { - values = found->second; + assert(found->second != NULL); + values = *found->second; } } diff -r e300f22a46f0 -r ebcbb448bea8 OrthancServer/Sources/Database/FindResponse.h --- a/OrthancServer/Sources/Database/FindResponse.h Sat Jul 06 14:24:45 2024 +0200 +++ b/OrthancServer/Sources/Database/FindResponse.h Sat Jul 06 14:31:22 2024 +0200 @@ -69,14 +69,16 @@ class ChildrenInformation : public boost::noncopyable { private: - typedef std::map > MetadataValues; - typedef std::map > MainDicomTagValues; + typedef std::map* > MetadataValues; + typedef std::map* > MainDicomTagValues; std::set identifiers_; MetadataValues metadataValues_; MainDicomTagValues mainDicomTagValues_; public: + ~ChildrenInformation(); + void AddIdentifier(const std::string& identifier); const std::set& GetIdentifiers() const