Stay organized with collections
Save and categorize content based on your preferences.
OutOfMemoryError
open class OutOfMemoryError : VirtualMachineError
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 writable.
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 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# OutOfMemoryError\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOutOfMemoryError\n================\n\n```\nopen class OutOfMemoryError : VirtualMachineError\n```\n\n|---|---|---|---|---------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) ||||\n| | ↳ | [java.lang.Error](/reference/kotlin/java/lang/Error) |||\n| | | ↳ | [java.lang.VirtualMachineError](/reference/kotlin/java/lang/VirtualMachineError) ||\n| | | | ↳ | [java.lang.OutOfMemoryError](#) |\n\nThrown 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 [writable](/reference/kotlin/java/lang/Throwable#Throwable(kotlin.String,%20kotlin.Throwable,%20kotlin.Boolean,%20kotlin.Boolean)).\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [OutOfMemoryError](#OutOfMemoryError())`()` Constructs an `OutOfMemoryError` with no detail message. |\n| [OutOfMemoryError](#OutOfMemoryError(kotlin.String))`(`s:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructs an `OutOfMemoryError` with the specified detail message. |\n\nPublic constructors\n-------------------\n\n### OutOfMemoryError\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nOutOfMemoryError()\n```\n\nConstructs an `OutOfMemoryError` with no detail message. \n\n### OutOfMemoryError\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nOutOfMemoryError(s: String!)\n```\n\nConstructs an `OutOfMemoryError` with the specified detail message.\n\n| Parameters ||\n|-----|--------------------------------------------------------------------------------------------------------|\n| `s` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the detail message. |"]]