Feb 02 2014 | 4:16 pm
    Hello !
    if i would use OBJ_FLAG_MEMORY for "hashtab" . how i should manage freeing memory if for example im "overwriting" its key content ? do i need to delete associated object value of that key before assigning new one ? i just noticed that it costs a lot of cpu cycles . anyway ... would it be better to use OBJ_FLAG_DATA and use "chuck" method for particular key ? but how to ... manage it all :/
    void foo_float(t_foo *x, double n){
      ///// hashtab_delete(x->hash,_sym_float);	???
    	t_atom *a = (t_atom*)sysmem_newptr(sizeof(t_atom));
    	atom_setfloat(a, n) ;
     	hashtab_store(x->hash, _sym_float , (t_object *)a);

    • Feb 04 2014 | 7:05 am
      Quoting from the sdk documentation:
      The difference between hashtab_store_safe() and hashtab_store() is what happens in the event of a collision in the hash table. The normal hashtab_store() function will free the existing value at the collision location with sysmem_freeptr() and then replaces it.
      ... actually, I suspect the text is not 100% accurate, as in the standard case the value should get freed with object_free() - iirc, I checked this out at some point. But with OBJ_FLAG_MEMORY things should be as described.
      best aa
    • Feb 04 2014 | 9:49 am
      Thank you for the clue Andrea !