def nvmlDeviceGetMemoryInfo(handle):
    r"""
    /**
     * Retrieves the amount of used, free and total memory available on the device, in bytes.
     *
     * For all products.
     *
     * Enabling ECC reduces the amount of total available memory, due to the extra required parity bits.
     * Under WDDM most device memory is allocated and managed on startup by Windows.
     *
     * Under Linux and Windows TCC, the reported amount of used memory is equal to the sum of memory allocated
     * by all active channels on the device.
     *
     * See \ref nvmlMemory_t for details on available memory info.
     *
     * @param device                               The identifier of the target device
     * @param memory                               Reference in which to return the memory information
     *
     * @return
     *         - \ref NVML_SUCCESS                 if \a memory has been populated
     *         - \ref NVML_ERROR_UNINITIALIZED     if the library has not been successfully initialized
     *         - \ref NVML_ERROR_INVALID_ARGUMENT  if \a device is invalid or \a memory is NULL
     *         - \ref NVML_ERROR_GPU_IS_LOST       if the target GPU has fallen off the bus or is otherwise inaccessible
     *         - \ref NVML_ERROR_UNKNOWN           on any unexpected error
     */
    nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo
    """
    c_memory = c_nvmlMemory_t()
    fn = _nvmlGetFunctionPointer("nvmlDeviceGetMemoryInfo")
    ret = fn(handle, byref(c_memory))
    _nvmlCheckReturn(ret)
    return bytes_to_str(c_memory)
r"""
    /**
     * Retrieves the amount of used, free and total memory available on the device, in bytes.
     *
     * For all products.
     *
     * Enabling ECC reduces the amount of total available memory, due to the extra required parity bits.
     * Under WDDM most device memory is allocated and managed on startup by Windows.
     *
     * Under Linux and Windows TCC, the reported amount of used memory is equal to the sum of memory allocated
     * by all active channels on the device.
     *
     * See \ref nvmlMemory_t for details on available memory info.
     *
     * @param device                               The identifier of the target device
     * @param memory                               Reference in which to return the memory information
     *
     * @return
     *         - \ref NVML_SUCCESS                 if \a memory has been populated
     *         - \ref NVML_ERROR_UNINITIALIZED     if the library has not been successfully initialized
     *         - \ref NVML_ERROR_INVALID_ARGUMENT  if \a device is invalid or \a memory is NULL
     *         - \ref NVML_ERROR_GPU_IS_LOST       if the target GPU has fallen off the bus or is otherwise inaccessible
     *         - \ref NVML_ERROR_UNKNOWN           on any unexpected error
     */
    nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo