Contains methods that return limit information for specific resources.

The Limits methods return the specific limit for the particular governor, such as the number of calls of a method or the amount of heap size remaining.

Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that runaway Apex doesn’t monopolize shared resources.

None of the Limits methods require an argument. The format of the limits methods is as follows:

myDMLLimit = Limits.getDMLStatements();

There are two versions of every method: the first returns the amount of the resource that has been used while the second version contains the word limit and returns the total amount of the resource that is available.

The following are methods for `Limits`. All methods are static.

Returns the number of aggregate queries that have been processed with any SOQL query statement.

`public static Integer getAggregateQueries()`

Type: Integer

Returns the total number of aggregate queries that can be processed with SOQL query statements.

`public static Integer getLimitAggregateQueries()`

Type: Integer

Returns the number of Web service statements that have been processed.

`public static Integer getCallouts()`

Type: Integer

Returns the total number of Web service statements that can be processed.

`public static Integer getLimitCallouts()`

Type: Integer

Deprecated. Returns the number of child relationship objects that have been returned.

`public static Integer getChildRelationshipsDescribes()`

Type: Integer

Deprecated. Returns the maximum number of child relationship objects that can be returned.

`public static Integer getLimitChildRelationshipsDescribes()`

Type: Integer

Returns the CPU time (in milliseconds) accumulated on the Salesforce servers in the current transaction.

`public static Integer getCpuTime()`

Type: Integer

Returns the time limit (in milliseconds) of CPU usage in the current transaction.

`public static Integer getLimitCpuTime()`

Type: Integer

Returns the number of records that have been processed with any statement that counts against DML limits, such as DML statements, the `Database.emptyRecycleBin` method, and other methods.

`public static Integer getDMLRows()`

Type: Integer

Returns the total number of records that can be processed with any statement that counts against DML limits, such as DML statements, the `database.EmptyRecycleBin` method, and other methods.

`public static Integer getLimitDMLRows()`

Type: Integer

Returns the number of DML statements (such as `insert`, `update` or the `database.EmptyRecycleBin` method) that have been called.

`public static Integer getDMLStatements()`

Type: Integer

Returns the total number of DML statements or the `database.EmptyRecycleBin` methods that can be called.

`public static Integer getLimitDMLStatements()`

Type: Integer

Returns the number of email invocations (such as `sendEmail`) that have been called.

`public static Integer getEmailInvocations()`

Type: Integer

Returns the total number of email invocation (such as `sendEmail`) that can be called.

`public static Integer getLimitEmailInvocations()`

Type: Integer

Deprecated. Returns the number of field describe calls that have been made.

`public static Integer getFieldsDescribes()`

Type: Integer

Deprecated. Returns the maximum number of field describe calls that can be made.

`public static Integer getLimitFieldsDescribes()`

Type: Integer

Deprecated. Returns the number of field set describe calls that have been made.

`public static Integer getFieldSetsDescribes()`

Type: Integer

Deprecated. Returns the maximum number of field set describe calls that can be made.

`public static Integer getLimitFieldSetsDescribes()`

Type: Integer

This method is deprecated. Returns the same value as `getSoslQueries`. The number of `findSimilar` methods is no longer a separate limit, but is tracked as the number of SOSL queries issued.

`public static Integer getFindSimilarCalls()`

Type: Integer

This method is deprecated. Returns the same value as `getLimitSoslQueries`. The number of `findSimilar` methods is no longer a separate limit, but is tracked as the number of SOSL queries issued.

`public static Integer getLimitFindSimilarCalls()`

Type: Integer

Returns the number of methods with the `future` annotation that have been executed (not necessarily completed).

`public static Integer getFutureCalls()`

Type: Integer

Returns the total number of methods with the `future` annotation that can be executed (not necessarily completed).

`public static Integer getLimitFutureCalls()`

Type: Integer

Returns the approximate amount of memory (in bytes) that has been used for the heap.

`public static Integer getHeapSize()`

Type: Integer

Returns the total amount of memory (in bytes) that can be used for the heap.

`public static Integer getLimitHeapSize()`

Type: Integer

Returns the number of Apex calls that have been used by mobile push notifications during the current metering interval.

`public static Integer getMobilePushApexCalls()`

Type:Integer

`public static Integer getLimitMobilePushApexCalls()`

Type:Integer

Deprecated. Returns the number of PicklistEntry objects that have been returned.

`public static Integer getPicklistDescribes()`

Type: Integer

Deprecated. Returns the maximum number of PicklistEntry objects that can be returned.

`public static Integer getLimitPicklistDescribes()`

Type: Integer

Returns the number of SOQL queries that have been issued.

`public static Integer getQueries()`

Type: Integer

Returns the total number of SOQL queries that can be issued.

`public static Integer getLimitQueries()`

Type: Integer

Returns the number of records that have been returned by the `Database.getQueryLocator` method.

`public static Integer getQueryLocatorRows()`

Type: Integer

Returns the total number of records that have been returned by the `Database.getQueryLocator` method.

`public static Integer getLimitQueryLocatorRows()`

Type: Integer

Returns the number of records that have been returned by issuing SOQL queries.

`public static Integer getQueryRows()`

Type: Integer

Returns the total number of records that can be returned by issuing SOQL queries.

`public static Integer getLimitQueryRows()`

Type: Integer

Returns the number of queueable jobs that have been added to the queue per transaction. A queueable job corresponds to a class that implements the `Queueable` interface.

`public static Integer getQueueableJobs()`

Type: Integer

Returns the maximum number of queueable jobs that can be added to the queue per transaction. A queueable job corresponds to a class that implements the `Queueable` interface.

`public static Integer getLimitQueueableJobs()`

Type: Integer

Deprecated. Returns the number of RecordTypeInfo objects that have been returned.

`public static Integer getRecordTypesDescribes()`

Type: Integer

Deprecated. Returns the maximum number of RecordTypeInfo objects that can be returned.

`public static Integer getLimitRecordTypesDescribes()`

Type: Integer

This method is deprecated. Returns the same value as `getDMLStatements`.

`public static Integer getRunAs()`

Type: Integer

The number of `RunAs` methods is no longer a separate limit, but is tracked as the number of DML statements issued.

This method is deprecated. Returns the same value as `getLimitDMLStatements`.

`public static Integer getLimitRunAs()`

Type: Integer

The number of `RunAs` methods is no longer a separate limit, but is tracked as the number of DML statements issued.

This method is deprecated. Returns the same value as `getDMLStatements`.

`public static Integer getSavepointRollbacks()`

Type: Integer

The number of `Rollback` methods is no longer a separate limit, but is tracked as the number of DML statements issued.

This method is deprecated. Returns the same value as `getLimitDMLStatements`.

`public static Integer getLimitSavepointRollbacks()`

Type: Integer

The number of `Rollback` methods is no longer a separate limit, but is tracked as the number of DML statements issued.

This method is deprecated. Returns the same value as `getDMLStatements`.

`public static Integer getSavepoints()`

Type: Integer

The number of `setSavepoint` methods is no longer a separate limit, but is tracked as the number of DML statements issued.

This method is deprecated. Returns the same value as `getLimitDMLStatements`.

`public static Integer getLimitSavepoints()`

Type: Integer

The number of `setSavepoint` methods is no longer a separate limit, but is tracked as the number of DML statements issued.

Deprecated. Returns a value that is based on CPU time usage and that is an approximation of script statement usage.

`public static Integer getScriptStatements()`

Type: Integer

Deprecated. Returns the maximum number of Apex statements that can execute.

`public static Integer getLimitScriptStatements()`

Type: Integer

Returns the number of SOSL queries that have been issued.

`public static Integer getSoslQueries()`

Type: Integer

Returns the total number of SOSL queries that can be issued.

`public static Integer getLimitSoslQueries()`

Type: Integer