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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:42:30+00:00 2026-05-23T10:42:30+00:00

map<long long, vector<SoundInfo *> > DataCenter::getCopySoundListMap(){ lock(); map<long long, vector<SoundInfo *> > copyMap(m_soundListMap); unLock();

  • 0
map<long long, vector<SoundInfo *> > DataCenter::getCopySoundListMap(){

    lock();

    map<long long, vector<SoundInfo *> > copyMap(m_soundListMap);

    unLock();

    return copyMap;
}

I have this method. It makes a copy of map and returns the copy.

I am calling this method like this

map<long long, vector<SoundInfo *> > copyMap = DataCenter::getInstance()->getCopySoundListMap();

After I am done with it at the end of the function, I did something like this

delete copyMap;

And it complains that this is not a pointer.. I know that this is not a pointer then I was wondering when the instance of the copied map is going to be released.

Thanks in advance…

  • 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-23T10:42:31+00:00Added an answer on May 23, 2026 at 10:42 am

    It’s a local variable, so it gets released when it goes out of scope… that is, when the {…} block it’s inside reaches that }. It doesn’t matter whether it’s a function scope, a for or while loop, just an arbitrarily blocked group of statements… the variables introduced inside that block have their destructors invoked at the end. The memory for the map object itself comes from the stack, and is reclaimed for use by further variables, perhaps locals from other functions that are called. That map object – while non-empty – will have pointers into heap memory as well, they’ll be released during destruction.

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

Sidebar

Related Questions

this might be an odd question, but I have a map Long-String pair: 10
I have a Java method takes an argument of type Map<Long, Foo> . I
When I'm testing this static method public class SomeClass { public static long someMethod(Map
I have a really long port map where I want to replace a bunch
I have a map of the USA and a list of long, lat that
I have two maps of type Map<Long, Integer>, one named oldValues representing the old
I have a Scheme macro and a long list, and I'd like to map
In my action class I have a Map<Long, Set<String>> attribute, named accountsMap. Lets say
This is a relatively long post. F# has a matrix and vector type(in PowerPack
I have a Map[Long, String] which I would like iterate over in descending order

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.