On 09/27/2018 03:12 PM, Ian Davis wrote:
> 
> 
> On Thu, 27 Sep 2018, at 2:04 PM, Peter Mogensen wrote:
>>
>> Of course... it requires that you handle any collisions in hashing the
>> string key to an int yourself, but wrt. the value I curious if anyone
>> can see issued with just storing a uintptr instead of the pointer for
>> sync.Pool managed objects. - (provided you remember to call pool.Put()
>> before loosing the map reference or doing delete() on a key.)
>>
>> m[key] = uintptr(unsafe.Pointer(pool.Get().(*Object)))
>>
> 
> sync.Pools are cleared on every GC run so I expect that will cause some 
> issues with your approach
> 

I don't think so... the point being that the "huge" part comes from a
lot of objects tied up in the map, not so much in the garbage pile.
Of course I would still like Objects which I don't use anymore to be
collected. I just don't want the map to be checked for Objects I've
already promised myself to tell when are garbage.

/Peter

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to