If your object is already a `ref`, feel free to alias it as you need:
    
    
    var testTable: Table[string, MyObj]
    
    proc populateTable() =
      let sharedObj = MyObj(age: 42)
      testTable["key1"] = sharedObj
      testTable["key2"] = MyObj(age: 32)
      testTable["key3"] = sharedObj
      testTable["key4"] = sharedObj
      testTable["key5"] = sharedObj
      testTable["key6"] = sharedObj
    
    
    
    Run

Now `key1` and `key3` and `key4` etc all point to the same object and the 
memory requirements do not increase beyond what is needed to resize the 
`testTable` itself.

Reply via email to