这一次, 1:形状proc合并了,不要那么多"超级小"的函数,少起很多名字. 但是最开始的时候小函数很重要,因为我还很弱小.
2:createSheap也合并了很多小函数.
3:解决了[3]int 到[]slice的问题.直接用slice.clone 4:不用dynamic,如果可能.
5:output也可以用slice.clone解决.
6:同时应该用delete.
7:可以用很长的一大段: '''odin context = context
track: mem.Tracking_Allocator mem.tracking_allocator_init(&track, context.allocator) context.allocator = mem.tracking_allocator(&track)
defer { if len(track.allocation_map) > 0 { fmt.eprintf("=== %v allocations not freed: ===\n", len(track.allocation_map)) for _, entry in track.allocation_map { fmt.eprintf("- %v bytes @ %v\n", entry.size, entry.location) } } mem.tracking_allocator_destroy(&track) }
'''
来追踪泄露