On Sat, Sep 23, 2000 at 10:48:25AM -0700, [EMAIL PROTECTED] wrote:
> On 22 Sep, Chris Kuklewicz wrote:
> > Have a hash_set<char*> which holds new refcount 1 strings (and thus
> > has no int overhead), and a hash_map<char*, unsigned int> which holds
> > any refcount string.  A duplicate has to be searched for in both the
> > hash_map and hash_set when adding a new string.  When ++refcount on
> > char* in the hash_set, move char* to the hash_map with refcount 2.
> > Note: If the stored refcount in hash_map is zero, it means the string
> > is static and need never be freed, and the refcount stays at zero.
> > When --refcount, do not move char* back from hash_map to hash_set,
> > just leave it in hash_set with a refcount of 1.
> 
> Interesting idea -- do you know how much memory overhead there is for a
> hash_map? I really like the not duplicating strings -- in the case of
> the data that we're throwing at it that would be a good way to save
> memory.
> 
> Would you be interested in hacking on this?
> 

If the library hash_map has too much overhead, then someone could
replace it with a specialized version.  Replacing string with char*
saves a good deal of overhead in this scheme.

> 
> >> The only outside code change that needs to happen is that when someone
> >> creates a metadata/playlist object, the freestore pointer needs to get
> >> passed in.
> > 
> > Hmmm....here you seem to want the context (which is currently
> > singular?) to not be a guaranteed singleton.  But the freestore could
> > be a singleton, why not?  Then you could access it without needing to
> > pass its address to MetaData/PlaylistItem every single time.
> > 
> > 
> > extern freestore& get_album_freestore();  // Global function or method of 
>singleton.
> 
> The only problem is that global functions are not global under windows
> across DLL boundaries. While DLLs get mapped into the same address
> space, globals/global functions are not visible unless explicitly
> exported. We could pass this in as part of the initialization of each of
> the plugin DLLS, but that's kinda ugly and a pain too.
> 

Unless explicitly exported?  Sounds like an option.

What does the plugin initialization do at the moment?  If it passes in
any structure (context?), just add a field/method to that structure to let it
find the freestore if it needs it.

_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev

Reply via email to