open class OutOfMemoryError : VirtualMachineError
kotlin.Any
   ↳ kotlin.Throwable
   ↳ java.lang.Error
   ↳ java.lang.VirtualMachineError
   ↳ java.lang.OutOfMemoryError

Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. OutOfMemoryError objects may be constructed by the virtual machine as if suppression were disabled and/or the stack trace was not.

Summary

Public constructors

Constructs an OutOfMemoryError with no detail message.

Constructs an OutOfMemoryError with the specified detail message.

Public constructors

OutOfMemoryError

OutOfMemoryError()

Constructs an OutOfMemoryError with no detail message.

OutOfMemoryError

OutOfMemoryError(s: String!)

Constructs an OutOfMemoryError with the specified detail message.

Parameters
s String!: the detail message.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-02-13 UTC.