DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: map and memory leak

  1. #1
    Join Date
    Nov 2005

    map and memory leak

    Hi everyone,

    I built a map using C++, which contains 1833053 string keys, and the values are strings as well. It is quite reasonable that the memory use is increased during the map constrction. But, after the map is completed, I look at another big file line by line, and treat each line as a key, aiming to find the corresponding value in the map, I don't know why the memory use is still increased when using the map (rather than building the map.)

    I suspect there is some memory leak. Could anyone tell me how to sort this out?

  2. #2
    Join Date
    Dec 2004
    San Bernardino County, California
    Sounds as if you are making copies of the map or large portions of the map structure - either by design or inadvertently - during your search and/or retrieval.

  3. #3
    Join Date
    Jan 2007
    Are you using oststream anywhere ? if you do not call freeze, it causes memory leaks.

  4. #4
    Join Date
    Nov 2003
    I don't think it means that there is a leak. It could be paging, swapping, reallocation, etc. Some of the algorithms and member functions of std::map (I assume you meant that type of a map) also consume memory for sorting and creating local temporary copies. In short, there's no reason to worry so long as the memory is released when the map is destroyed.
    Danny Kalev

Similar Threads

  1. Replies: 18
    Last Post: 07-17-2002, 01:12 AM
  2. Mapping a drive letter to a memory location?
    By Pino Carafa in forum VB Classic
    Replies: 18
    Last Post: 07-31-2000, 04:00 AM
  3. Mapping a drive letter to a memory location?
    By Pino Carafa in forum VB Classic
    Replies: 0
    Last Post: 07-27-2000, 11:30 AM
  4. Why does it work? (filemapping)
    By Juergen Thuemmler in forum VB Classic
    Replies: 6
    Last Post: 06-12-2000, 06:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center