Skip to main content

imp.getmemoryfree()

Returns the amount of currently unused memory in the imp

Availability

Device + Agent

Returns

Integer — the amount of free RAM in bytes

Description

This method reports the amount of currently unused memory in the imp. The available memory within an imp may become fragmented. Hence allocating objects smaller than the free memory report can still fail, causing an out-of-memory error.

Example Code

Filling an array with 1KB blobs will very quickly fill an imp’s memory, as the following code demonstrates.