Showing posts with label Memory. Show all posts
Showing posts with label Memory. Show all posts

Monday, September 7, 2026

How to Find the Amount of RAM in a Linux Machine

How to find the number of RAM in Linux Machine (i.e. Mint OS). Its working for Mint OS and tested. 
sudo lshw -short



Example -

 

dev@developer-desktop $ sudo lshw -short
[sudo] password for dev:

H/W path Device Class Description

=========================================================
system 4518B8M (To be filled by O.E.M.)
/0 bus Motherboard
/0/0 memory 64KiB BIOS
/0/4 processor Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
/0/4/5 memory 128KiB L1 cache
/0/4/6 memory 1MiB L2 cache
/0/4/7 memory 6MiB L3 cache
/0/1b memory 4GiB System Memory
/0/1b/0 memory DIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>POT-Creation-Date: 2009-10-08 14:02+0200PO-Revision-Date: 2012-02-02 13:04+0000Last-T
/0/1b/1 memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns)
/0/1b/2 memory DIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>POT-Creation-Date: 2009-10-08 14:02+0200PO-Revision-Date: 2012-02-02 13:04+0000Last-T
/0/1b/3 memory 2GiB DIMM DDR3 Synchronous 1333 MHz (0.8 ns)
/0/100 bridge 2nd Generation Core Processor Family DRAM Controller
/0/100/2 display 2nd Generation Core Processor Family Integrated Graphics Controller
/0/100/16 communication 6 Series/C200 Series Chipset Family MEI Controller #1
/0/100/16.3 communication 6 Series/C200 Series Chipset Family KT Controller
/0/100/19 eth0 network 82579LM Gigabit Network Connection
/0/100/1a bus 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2
/0/100/1b multimedia 6 Series/C200 Series Chipset Family High Definition Audio Controller
/0/100/1d bus 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1
/0/100/1e bridge 82801 PCI Bridge
/0/100/1f bridge Q67 Express Chipset Family LPC Controller
/0/100/1f.2 scsi0 storage 6 Series/C200 Series Chipset Family SATA AHCI Controller
/0/100/1f.2/0 /dev/sda disk 250GB WDC WD2500AAKX-0
/0/100/1f.2/0/1 /dev/sda1 volume 96GiB EXT4 volume
/0/100/1f.2/0/2 /dev/sda2 volume 52GiB Extended partition
/0/100/1f.2/0/2/5 /dev/sda5 volume 51GiB Linux filesystem partition
/0/100/1f.2/0/2/6 /dev/sda6 volume 1469MiB Linux filesystem partition
/0/100/1f.2/1 /dev/cdrom disk DVD RW AD-7250H
/0/100/1f.3 bus 6 Series/C200 Series Chipset Family SMBus Controller
/1 power To Be Filled By O.E.M.
/2 power To Be Filled By O.E.M.



Above I have highlighted with red color , it shows 2 slots is reserved for 2 RAM. Hope it will help you.

Friday, September 4, 2026

Java/Tomcat: Understanding Out of Memory Error (OOME)

Out of Memory Error (OOME) in Tomcat

What is an Out of Memory Error, and why does it happen?

The basic cause of an OutOfMemoryError (OOME) is that the JVM cannot allocate enough memory for an application to continue running. In a Tomcat environment, this can result in an application failure or, depending on the situation, the Tomcat process being unable to continue.

The error itself is not particularly difficult to understand. The difficult part is finding the actual root cause.

A stack trace may show where the JVM ran out of memory, but it does not always identify why the application consumed so much memory. In many cases, the problem is related to the web application running inside Tomcat rather than Tomcat itself.

The code causing the problem may also look perfectly normal. For example, an application might load a large amount of data into memory, retain objects longer than necessary, or create too many objects during processing. This makes it difficult to identify which part of the application is actually responsible for the problem.

Here are some common causes of an OutOfMemoryError:

  • The JVM heap size is too small for the application's workload.
  • The application loads a very large file or a large amount of data into memory.
  • The application creates a large number of objects or collections.
  • Objects are unintentionally retained for longer than necessary, causing memory usage to grow.
  • Excessive recursion can cause a StackOverflowError rather than a heap OutOfMemoryError, so this should be considered a separate problem.
  • Too many threads can cause memory-related problems, although this may also result in errors such as Unable to create new native thread.
  • Running out of file descriptors is a separate operating-system resource issue and is not itself an OutOfMemoryError.
  • In older Java applications, a large number of web applications or classloaders could contribute to PermGen exhaustion.

Finding the Root Cause

Increasing the JVM heap size can sometimes reduce or temporarily resolve an OutOfMemoryError, but it does not necessarily fix the underlying problem. If the application continues to consume memory, increasing -Xmx only delays the failure.

For this reason, it is important to investigate the application's memory usage using appropriate JVM monitoring or profiling tools and identify which objects or parts of the application are consuming memory.

Note: PermGen applies to older Java versions. Java 8 removed PermGen and replaced it with Metaspace. Therefore, PermGen space errors are relevant mainly when troubleshooting older Java applications.