import resource


def used_memory(unit: int = 1024 * 1024 * 1024) -> float:
    """
    Get the memory usage of the current process.

    :param unit: Unit of the memory, default in Gigabytes.
    :return: Memory usage of the current process.
    """

    return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / unit