Example #1
0
    public void Update()
    {
        // Unity によって割り当てられたメモリ
        Used = (Profiler.GetTotalAllocatedMemoryLong() >> 10) / 1024f;

        // 予約済みだが割り当てられていないメモリ
        Unused = (Profiler.GetTotalUnusedReservedMemoryLong() >> 10) / 1024f;

        // Unity が現在および将来の割り当てのために確保している総メモリ
        Total = (Profiler.GetTotalReservedMemoryLong() >> 10) / 1024f;

        UsedText   = Used.ToString("0.0") + " MB";
        UnusedText = Unused.ToString("0.0") + " MB";
        TotalText  = Total.ToString("0.0") + " MB";

        var sb = new StringBuilder();

        sb.AppendLine("<b>Unity</b>");
        sb.AppendLine();
        sb.AppendLine($"    Used: {UsedText}");
        sb.AppendLine($"    Unused: {UnusedText}");
        sb.AppendLine($"    Total: {TotalText}");

        var text = sb.ToString();

        m_text.text = text;
    }
Example #2
0
        public void Update()
        {
            Used = (Profiler.GetMonoUsedSizeLong() >> 10) / 1024f;

            // ヒープが大きいほど GC の時間がかかりますが、実行される頻度は少なくなる
            Total = (Profiler.GetMonoHeapSizeLong() >> 10) / 1024f;

            UsedText  = Used.ToString("0.0") + " MB";
            TotalText = Total.ToString("0.0") + " MB";
        }
        public void Update()
        {
            // Unity によって割り当てられたメモリ
            Used = (Profiler.GetTotalAllocatedMemoryLong() >> 10) / 1024f;

            // 予約済みだが割り当てられていないメモリ
            Unused = (Profiler.GetTotalUnusedReservedMemoryLong() >> 10) / 1024f;

            // Unity が現在および将来の割り当てのために確保している総メモリ
            Total = (Profiler.GetTotalReservedMemoryLong() >> 10) / 1024f;

            UsedText   = Used.ToString("0.0") + " MB";
            UnusedText = Unused.ToString("0.0") + " MB";
            TotalText  = Total.ToString("0.0") + " MB";
        }