novowind / lru-cache-cpp Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/lru-cache-cpp
Automatically exported from code.google.com/p/lru-cache-cpp
* 1. Change hashtable to hash_map as the container
* 2. Add memory limit
* 3. Add value deletor(optional)
* 4. Change LRUCacheH4Value::Val : use a pointer to optimize the memory use
* 5. MS-VC compile pass
Original issue reported on code.google.com by [email protected]
on 11 Jul 2012 at 1:56
Attachments:
What is the expected output?
Expected empty() to return true if the cache was empty (as do stl collections).
What do you see instead?
Returns the inverse ( return size() > 0; )
What version of the product are you using? On what operating system?
No version in source. Latest
Original issue reported on code.google.com by [email protected]
on 16 Apr 2012 at 8:02
Can you provide a version with std::unordered_map instead of the ancient
hash_map? Thanks!
Original issue reported on code.google.com by [email protected]
on 6 Jan 2015 at 1:02
What steps will reproduce the problem?
1. use <std::string> as a Key type and <MyClass> as a Value type
<int> for MyClass will work here.
2. To make hash_map work with std::string I followed the tips from
http://the-lost-beauty.blogspot.com/2008/10/cc-gnucxx-hashmap-under-ubuntu-804.html and http://forums.devshed.com/c-programming-42/tip-about-stl-hash-map-and-string-55093.html
3. Declare LRUCache<std::string, MyClass> with 100 max_size elements.
I call LRUCache insert() method few hundreds of times.
Then cache is full the _erase() method is called - hence the key and value
should be available at this moment.
But I think what currently LRUCache does not keep std::string internally - it
just keeps string.c_str() which is not enough, because the original string from
main apps may be already destroyed.
And of course we do not want to keep in main application the millions of
std::string and MyClass objects for the application lifetime - it should be
business of LRUCache to keep the keys (not just the pointers to keys).
Currently I have the memory corruption in _erase() - it is reported by
valgrind.
Thanks for quick reply!
[email protected]
Original issue reported on code.google.com by [email protected]
on 26 Sep 2011 at 11:27
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.