zoukankan      html  css  js  c++  java
  • C# winfrom 当前程序内存读取和控制

    https://zhidao.baidu.com/question/31914620.html

    https://www.cnblogs.com/xcsn/p/4678322.html

    Process CurrentProcess = Process.GetCurrentProcess();
    CurrentProcess.Id.ToString();//PID
    ((Double)(CurrentProcess.TotalProcessorTime.TotalMilliseconds-CurrentProcess.UserProcessorTime.TotalMilliseconds)).ToString();//CPU
    (CurrentProcess.WorkingSet64 / 1024 / 1024).ToString() + "M (" + (CurrentProcess.WorkingSet64 / 1024).ToString() + "KB)";//占用内存
    CurrentProcess.Threads.Count.ToString();//线程

    #region 内存回收
    [DllImport("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize")]
    public static extern int SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize);
    /// <summary>
    /// 释放内存
    /// </summary>
    public static void ClearMemory()
    {
    GC.Collect();
    GC.WaitForPendingFinalizers();
    if (Environment.OSVersion.Platform == PlatformID.Win32NT)
    {
    App.SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);
    }
    }
    #endregion
  • 相关阅读:
    滚动加载图片
    轮播图
    各种插件
    IE兼容
    文字换行
    CSS3 transform用法
    隐藏手机号中间几位数
    js实现收藏,首页等功能
    loading练习
    animation练习
  • 原文地址:https://www.cnblogs.com/LuoEast/p/9447575.html
Copyright © 2011-2022 走看看