// Memory sets the memory of a pod container
437882
func (p *PodContainer) Memory(memory float64) *PodContainer {
	p.Resources.Mem = memory
	return p
}
544844
func (t *Thread) WriteMemory(addr uintptr, data []byte) (int, error) {
	return 0, ErrWriteCore
}
60117
func (c *Calcium) PodResource(ctx context.Context, podname string) (*types.PodResource, error) {
	nodes, err := c.ListPodNodes(ctx, podname, true)
	if err != nil {
		return nil, err
	}
	r := &types.PodResource{
		Name:       podname,
		CPUPercent: map[string]float64{},
		MEMPercent: map[string]float64{},
		Diff:       map[string]bool{},
		Detail:     map[string]string{},
	}
	for _, node := range nodes {
		containers, err := c.ListNodeContainers(ctx, node.Name)
		if err != nil {
			return nil, err
		}
		cpus := 0.0
		memory := int64(0)
		cpumap := types.CPUMap{}
		for _, container := range containers {
			cpus = utils.Round(cpus + container.Quota)
			memory += container.Memory
			cpumap.Add(container.CPU)
		}
		r.CPUPercent[node.Name] = cpus / float64(len(node.InitCPU))
		r.MEMPercent[node.Name] = float64(memory) / float64(node.InitMemCap)
		r.Diff[node.Name] = true
		r.Detail[node.Name] = ""
		cpumap.Add(node.CPU)
		if cpus != node.CPUUsed {
			r.Diff[node.Name] = false
			r.Detail[node.Name] += fmt.Sprintf("cpus %f now %f ", node.CPUUsed, cpus)
		}
		for i, v := range cpumap {
			if node.InitCPU[i] != v {
				r.Diff[node.Name] = false
				r.Detail[node.Name] += fmt.Sprintf("cpu %s now %d ", i, v)
			}
		}
		if memory+node.MemCap != node.InitMemCap {
			r.Diff[node.Name] = false
			r.Detail[node.Name] += fmt.Sprintf("mem now %d ", node.InitMemCap-(memory+node.MemCap))
		}

	}
	return r, nil
}
705506
func (c *cache) Store(res *Resource, keys ...string) error {
	var buf = &bytes.Buffer{}

	if length, err := strconv.ParseInt(res.Header().Get("Content-Length"), 10, 64); err == nil {
		if _, err = io.CopyN(buf, res, length); err != nil {
			return err
		}
	} else if _, err = io.Copy(buf, res); err != nil {
		return err
	}

	for _, key := range keys {
		delete(c.stale, key)

		if err := c.storeBody(buf, key); err != nil {
			return err
		}

		if err := c.storeHeader(res.Status(), res.Header(), key); err != nil {
			return err
		}
	}

	return nil
}
39128
func (s *TaskDefinition) SetMemory(v string) *TaskDefinition {
	s.Memory = &v
	return s
}
399937
func (world *World) Malloc(flags uint, size uint) *Memory {
	return &Memory{world, size}
}
1155596
func (m *MemoryBackend) Log(event LogEvent, client *Client, pkt packet.Generic, msg *packet.Message, err error) {
	// call logger if available
	if m.Logger != nil {
		m.Logger(event, client, pkt, msg, err)
	}
}
1147221
func (c *Container) Mem() uint {
	v := c.Config["limits.memory"]
	if v == "" {
		return 0
	}

	bytes, err := shared.ParseByteSizeString(v)
	if err != nil {
		logger.Errorf("failed to parse %q into bytes, ignoring err: %s", v, err)
		return 0
	}

	const oneMiB = 1024 * 1024
	mib := bytes / oneMiB
	if mib > math.MaxUint32 {
		logger.Errorf("byte string %q overflowed uint32, using max value", v)
		return math.MaxUint32
	}

	return uint(mib)
}
189631
func (m *MockInterface) Storage() v17.StorageV1Interface {
	ret := m.ctrl.Call(m, "Storage")
	ret0, _ := ret[0].(v17.StorageV1Interface)
	return ret0
}
1272733
func (l *logger) Write(data []byte) (int, error) {
	return l.container.Write(data)
}
945330
func (s *storeImpl) Size() int {
	s.mutex.RLock()
	defer s.mutex.RUnlock()
	return len(s.objects)
}
985617
func (t *Thread) ReadMemory(buf []byte, addr uintptr) (int, error) {
	panic(ErrNativeBackendDisabled)
}
1003597
func (s *MemoryStore) Delete(key string) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	delete(s.data, key)
	return nil
}
310095
func (c *memoryStore) Size() int {
	c.RLock()
	defer c.RUnlock()
	return len(c.s)
}
925354
func (m *Memory) Resize(size uint64) {
	if uint64(m.Len()) < size {
		m.store = append(m.store, make([]byte, size-uint64(m.Len()))...)
	}
}
620957
func (s *ContainerOverride) SetMemory(v int64) *ContainerOverride {
	s.Memory = &v
	return s
}
1174755
func (t *Thread) WriteMemory(addr uintptr, data []byte) (int, error) {
	panic(ErrNativeBackendDisabled)
}