generated at
Nimのobject
object
Nim
type Hoge = object x: int y: int
構造体
デフォルトでスタックに割当

ref object
Nim
type Hoge = ref object x: int y: int
ヒープに割り当てられる構造体
objectで作ったものをref版も作れる
Nim
type Piyo = object x: int type Hoge = ref Piyo

ptr object
Nim
type Hoge = ptr object x: int y: int
ヒープに割り当てられるが、GCに追跡されない
通常は ref object を使うことが推奨される

参考