// GetMemoryGB メモリ(GB) 取得
2770
func (p *propPrivateHostPlan) GetMemoryGB() int {
	if p.Plan == nil {
		return -1
	}

	return p.Plan.GetMemoryGB()
}
252832
func ZeroMemory(ctx context, name string, offset int, size uint, reg *register) string {
	chunk := uint(1)
	if size%8 == 0 {
		chunk = 8
	} else if size%4 == 0 {

		chunk = 4
	} else if size%2 == 0 {

		chunk = 2
	} else {

		chunk = 1
	}
	asm := ""
	if size/chunk == 0 {
		return asm
	}
	datatype := OpDataType{OP_DATA, InstrData{signed: false, size: chunk}, XMM_INVALID}
	mov := GetInstr(I_MOV, datatype)
	for i := uint(0); i < size/chunk; i++ {
		ioffset := int(i*chunk) + offset
		asm += instrImmMem(ctx, mov, 0, reg, name, ioffset)
	}
	return asm
}
1253818
func Get() (m MemInfo, err error) {
	err = m.Get()
	return m, err
}
521212
func (tk *logTagKey) bytes() int {
	var b int
	b += len(tk.name)
	for k, v := range tk.tagValues {
		b += len(k)
		b += v.bytes()
	}
	b += int(unsafe.Sizeof(*tk))
	return b
}
1290461
func NewMemoryBackend(max int) *MemoryBackend {
	return &MemoryBackend{
		messages: make(chan *gomail.Message, max),
	}
}
371659
func isMemoryUnit(unit string) bool {
	switch strings.TrimSuffix(strings.ToLower(unit), "s") {
	case "byte", "b", "kilobyte", "kb", "megabyte", "mb", "gigabyte", "gb":
		return true
	}
	return false
}
544844
func (t *Thread) WriteMemory(addr uintptr, data []byte) (int, error) {
	return 0, ErrWriteCore
}
585521
func (conn *gdbConn) writeMemory(addr uintptr, data []byte) (written int, err error) {
	if len(data) == 0 {
		// LLDB can't parse requests for 0-length writes and hangs if we emit them
		return 0, nil
	}
	conn.outbuf.Reset()
	//TODO(aarzilli): do not send packets larger than conn.PacketSize
	fmt.Fprintf(&conn.outbuf, "$M%x,%x:", addr, len(data))

	writeAsciiBytes(&conn.outbuf, data)

	_, err = conn.exec(conn.outbuf.Bytes(), "memory write")
	if err != nil {
		return 0, err
	}
	return len(data), nil
}
1033311
func (c *Client) GetMempoolEntry(txHash string) (*btcjson.GetMempoolEntryResult, error) {
	return c.GetMempoolEntryAsync(txHash).Receive()
}
1060219
func (m *MemDB) ApproximateMemoryUsage() int {
	m.mutex.RLock()
	defer m.mutex.RUnlock()
	return len(m.kvData)
}
629089
func GetApproximateMemoryUsageByType(dbs []*DB, caches []*Cache) (*MemoryUsage, error) {
	// register memory consumers
	consumers := C.rocksdb_memory_consumers_create()
	defer C.rocksdb_memory_consumers_destroy(consumers)

	for _, db := range dbs {
		if db != nil {
			C.rocksdb_memory_consumers_add_db(consumers, db.c)
		}
	}
	for _, cache := range caches {
		if cache != nil {
			C.rocksdb_memory_consumers_add_cache(consumers, cache.c)
		}
	}

	// obtain memory usage stats
	var cErr *C.char
	memoryUsage := C.rocksdb_approximate_memory_usage_create(consumers, &cErr)
	if cErr != nil {
		defer C.free(unsafe.Pointer(cErr))
		return nil, errors.New(C.GoString(cErr))
	}

	defer C.rocksdb_approximate_memory_usage_destroy(memoryUsage)

	result := &MemoryUsage{
		MemTableTotal:        uint64(C.rocksdb_approximate_memory_usage_get_mem_table_total(memoryUsage)),
		MemTableUnflushed:    uint64(C.rocksdb_approximate_memory_usage_get_mem_table_unflushed(memoryUsage)),
		MemTableReadersTotal: uint64(C.rocksdb_approximate_memory_usage_get_mem_table_readers_total(memoryUsage)),
		CacheTotal:           uint64(C.rocksdb_approximate_memory_usage_get_cache_total(memoryUsage)),
	}
	return result, nil
}
44499
func (p *propSizeMB) SetSizeGB(size int) {
	if size <= 0 {
		p.SizeMB = 0
	} else {
		p.SizeMB = size * 1024
	}
}
913465
func (r Virtual_Guest) GetMemoryMetricImage(snapshotRange *string, dateSpecified *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {
	params := []interface{}{
		snapshotRange,
		dateSpecified,
	}
	err = r.Session.DoRequest("SoftLayer_Virtual_Guest", "getMemoryMetricImage", params, &r.Options, &resp)
	return
}
880906
func isMemoryGuaranteed(container *api.Container) bool {
	// A container is memory guaranteed if its memory request == memory limit.
	// If memory request == memory limit, the user is very confident of resource consumption.
	memoryRequest := container.Resources.Requests.Memory()
	memoryLimit := container.Resources.Limits.Memory()
	return (*memoryRequest).Cmp(*memoryLimit) == 0 && memoryRequest.Value() != 0
}
558990
func getMemory() (string, error) {
	bytes, err := ioutil.ReadFile(meminfo)
	if err != nil {
		return "", err
	}

	lines := string(bytes)

	for _, line := range strings.Split(lines, "\n") {
		if !strings.HasPrefix(line, "MemTotal") {
			continue
		}

		expectedFields := 2

		fields := strings.Split(line, ":")
		count := len(fields)

		if count != expectedFields {
			return "", fmt.Errorf("expected %d fields, got %d in line %q", expectedFields, count, line)
		}

		if fields[1] == "" {
			return "", fmt.Errorf("cannot determine total memory from line %q", line)
		}

		memTotal := strings.TrimSpace(fields[1])

		return memTotal, nil
	}

	return "", fmt.Errorf("no lines in file %q", meminfo)
}
317838
func (m *MemoryStorer) Get(key string) (value string, err error) {
	m.mut.RLock()
	session, ok := m.sessions[key]
	m.mut.RUnlock()
	if !ok {
		return "", errNoSession{}
	}

	return session.value, nil
}
216974
func (s *InMemorySender) GetString() ([]string, error) {
	msgs := s.Get()
	strs := make([]string, 0, len(msgs))
	for _, msg := range msgs {
		str, err := s.Formatter(msg)
		if err != nil {
			return nil, err
		}
		strs = append(strs, str)
	}
	return strs, nil
}