ITPub博客

首页 > 数据库 > 数据库开发技术 > 善用佳软: Win10下磁盘空间检查并自动排序

善用佳软: Win10下磁盘空间检查并自动排序

原创 数据库开发技术 作者:数据库杂记 时间:2023-05-15 07:00:00 0 删除 编辑


tag: 善用佳软

背景:

连续整理好多天数据库相关的短文了,拿一些日常软件工具的使用方法调剂过渡一下。

Win10跟Linux相比,有些工具或命令的功能是比较缺失的,或者说,难以让人满意。比如:我想快速得到某一个目录占用多少磁盘空间?如何破?

Linux下一个命令du -sh 就能快速搞定。windows下边,你可以点击Mouse,经过漫长的等待,…… 最后往往难以忍受,于是放弃了。

分析:

曾经因为C盘剩余空间很少,然后又不太确定是哪些目录占据过多的空间。希望快速找到一款工具,能快速定位哪些目录哪些文件消耗空间比较多。甚至为此还用脚本写了一个批处理,但是仍然感觉不是很理想。直到找到一款工具:TreeSizeFreePortable/TreeSizeFree。下载的地方可以自行google/baidu。(

https://www.jam-software.com/treesize_free)

这款工具的好处就是以树形的方式层层展示目录或文件所占用的磁盘空间大小,并且还可以为你排好序。这样磁盘空间消耗情况就一目了然。当然这种工具,”巨硬“可能不想做吧。如果要吐槽,会有很多地方可以吐。

我们看看效果:

然后你朝比较大的目录下边层层点开,基本上哪些目录或文件占的空间太多,就非常清楚了,想做手动清理,也就变得心中有数了。如果是有如我这样懒惰的,总是拼命用电脑资源,直到不够用,才想着去清理或优化调整,那么这款工具说不定可以帮你的大忙。

我有处边的工具,一次性将系统中不必要的cache,  SWAP page以及一些不用的tmp或vm文件清掉,清除了100来G的空间,系统也一下子清爽了不少。

补充另一外一个玩意儿:

I have 32GB RAM in windows 10 (x64),  available RAM is 58%. why still there is OOM error: Out of swap space or heap resource limit exceeded?

这个现象确实出乎我的意料之外。发生在我将虚存设为1G,在运行maven/javac的时候,报的错:

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1121776 bytes for Chunk::new. Out of swap space or heap resource limit exceeded (check with limits or ulimit)?
# Possible reasons:
#   The system is out of physical RAM or swap space
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Zero Based Compressed Oops mode in which the Java heap is
#     placed in the first 32GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 32GB virtual address.

这个确实有些出乎我的意料之外。因为我的真实内存32G这时根本就没有用完。我原来甚至想虚存一点不留,全部关掉,那样出错的机率更高。上边是设为1G时候的报错。直到我将它设置为5G左右,才算稳定下来。这个问题其实是值得深入研究的。应该跟Win x64的内存分配策略有关。

在我的原始理解里头,在虚存关掉的时候,应该优先使用RAM中的内存去构建真实的虚拟地址空间,可事实上,会出现上边JVM的memory的错,看起来是SWAP空间还是需要设置的。

可以查到的答案:

Out of Memory (OOM) errors can be caused by various reasons, even if you have a significant amount of RAM. Here are some possible reasons and solutions for your OOM error:

1. Memory Leak: A memory leak occurs when a program does not release memory it has allocated but is no longer using. Over time, this can cause the system to run out of memory. To resolve this, identify the application causing the leak and update or fix it.

2. Virtual Memory: Windows uses virtual memory, which includes RAM and swap space (also known as the page file). If the page file is too small or improperly configured, you may run out of virtual memory, leading to an OOM error. To resolve this, you can increase the size of the page file, or allow Windows to automatically manage it.

3. High Memory Usage: Some applications may require a large amount of memory to function correctly. In this case, you may need to close other applications to free up memory or increase your system's RAM.

4. Java Heap Space: If you'
re running a Java application, you might encounter an OOM error due to heap space limitations. You can increase the maximum heap size using the `-Xmx` command-line option when starting your Java application (e.g., `-Xmx4g` for a 4GB heap size).

5. Resource Limits: Some systems may have resource limits configured that restrict the amount of memory a single process or user can allocate. Check your system's resource limits and adjust them if necessary.

To identify the specific cause of the OOM error, monitor your system'
s resource usage and check logs or error messages for more information. This will help you pinpoint the issue and apply the appropriate solution.



原文作者:数据库杂记;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2019-04-22

  • 博文量
    276
  • 访问量
    160349