示例#1
0
文件: membind.go 项目: liudch/gocoin
func (v *oneIdx) LoadData(f *os.File) {
	if v.data != nil {
		panic("This should not happen")
	}
	v.data = data_ptr_t(C.my_alloc(C.ulong(v.datlen)))
	atomic.AddInt64(&ExtraMemoryConsumed, int64(v.datlen))
	atomic.AddInt64(&ExtraMemoryAllocCnt, 1)
	f.Seek(int64(v.datpos), os.SEEK_SET)
	f.Read(*(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{Data: uintptr(v.data), Len: int(v.datlen), Cap: int(v.datlen)})))
}
示例#2
0
func gcc_HeapAlloc(le uint32) data_ptr_t {
	return data_ptr_t(C.my_alloc(C.ulong(le)))
}