Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2006

Tip: Looking for answers? Try searching our database.

hash_map question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
filox - 01 Nov 2006 10:44 GMT
i just  don't get it:

hash_map<double, int> mapa;

double md = 0;

for(int j=0;j<1000000;++j)

{

mapa[md] = 3;

md++;

}

the above code takes up 70 MB of RAM. how??? any ideas?

Signature

You're never too young to have a Vietnam flashback

Ben Voigt - 01 Nov 2006 15:15 GMT
>i just  don't get it:
>
[quoted text clipped - 13 lines]
>
> the above code takes up 70 MB of RAM. how??? any ideas?

You're storing one million items in a hash_map, which has significant
overhead (hash buckets and linked lists, etc), why are you surprised?

Because of the uncertain equality of floating-point numbers, using doubles
as hash_map keys has questionable utility.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.