Package | flash.errors |
Class | public dynamic class MemoryError |
Inheritance | MemoryError Error Object |
Language Version: | ActionScript 3.0 |
Runtime Versions: | AIR 1.0, Flash Player 9, Flash Lite 4 |
On a desktop machine, memory allocation failures are rare unless an allocation request is extremely large. For example, a 32-bit Windows program can access only 2GB of address space, so a request for 10 billion bytes is impossible.
By default, Flash Player does not impose a limit on how much memory an ActionScript program can allocate.
More examples
Public Properties
Public Methods
Method | Defined By | ||
---|---|---|---|
MemoryError(message:String = "")
Creates a new MemoryError object. | MemoryError | ||
Returns the call stack for an error at the time of the error's
construction as a string. | Error | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
[override]
Returns the string "Error" by default or the value contained in the Error.message property,
if defined. | Error | ||
Returns the primitive value of the specified object. | Object |
Constructor Detail
MemoryError | () | Constructor |
Examples How to use this example
MemoryErrorExample.as
The following example shows one method of generating a MemoryError.
package { import flash.display.Sprite; import flash.errors.MemoryError; import flash.utils.setInterval; public class MemoryErrorExample extends Sprite { private var crashingStr:String; private var intervalId:Number; public function MemoryErrorExample() { crashingStr = "abcdefghijklmnopqrstuvwxyz"; intervalId = setInterval(exhaustMemory, 50); } public function exhaustMemory():void { try { crashingStr += crashingStr; } catch(e:MemoryError) { trace(e); } } } }
Thu Dec 6 2018, 01:12 PM -08:00