ModularM
Modular3y ago
1 reply
rd4com

Swapping pointers would cause memory problems ?

Hello, does this code would cause problems please?
the motivation is to not allocate another pointer of the same size and not do a copy
var fd = open("stories15M.bin","r")
var data = fd.read()
fd.close()

let cp_buf = data._as_ptr().bitcast[DType.uint8]()
data._buffer.data = data._buffer.data.get_null().alloc(1)
data._buffer.size = 1
data._buffer.capacity = 1
_=data

https://github.com/tairov/llama2.mojo/pull/50
Was this page helpful?