---
title: Set max event pool size
source: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/set-max-event-pool-size
---

## Android

### Syntax [#syntax]

#### Java [#java]

```java
NewRelic.setMaxEventPoolSize(int $maxSize)
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.setMaxEventPoolSize(maxSize: Int)
```

### Description [#description]

Sets the maximum size of the event pool.

By default, mobile monitoring collects a maximum of 1,000 events per event harvest cycle, which is 60 seconds long by default.
This method controls the maximum size of the event pool stored in the memory until the next harvest cycle. When the pool size limit is reached, the New Relic Android agent will begin  [sampling events](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/new-relic-events-limits-sampling), discarding some old and some new events, until the pool of events are transmitted with the next harvest cycle. This method lets you override the maximum size of that event pool.

The default value for the event harvest cycle is 60 seconds. See [Set max event buffer time](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/set-max-event-buffer-time) to change the length of the event harvest cycle.

> #### ⚠️ IMPORTANT
>
> Be aware that reporting a large number of events, or reporting events too frequently, may impact app performance.

### Parameters [#parameters]

| Parameter  | Type  | Description                           |
| ---------- | ----- | ------------------------------------- |
| `$maxSize` | `int` | Required. Maximum size of event pool. |

### Example [#example]

Here's an example to set max size of event pool to 1000:

#### Java [#java]

```java
NewRelic.setMaxEventPoolSize(1000);
```

#### Kotlin [#kotlin]

```kotlin
NewRelic.setMaxEventPoolSize(1000)
```

## iOS

### Syntax [#syntax]

#### Objective-C [#objc]

```objectivec
+ (void) setMaxEventPoolSize:(unsigned int)size;
```

#### Swift [#swift]

```swift
NewRelic.setMaxEventPoolSize(unsigned int $size)
```

### Description [#description]

Sets the maximum size of the event pool.

By default, the iOS agent collects a maximum of 1000 events per [harvest cycle](https://docs.newrelic.com/docs/accounts-partnerships/education/getting-started-new-relic/glossary#harvest-cycle).
This method controls the maximum size of the event pool stored in the memory until the next harvest cycle. When the pool size limit is reached, the New Relic iOS agent will begin [sampling events](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/new-relic-events-limits-sampling), discarding some old and some new events, until the pool of events are transmitted with the next harvest cycle.
This method lets you override the maximum size of that event pool. You must set this value after `Agent.start()` is called.

> #### ⚠️ IMPORTANT
>
> While you can set the event pool size greater than `1000`, the agent imposes a strict internal limit on network data. A maximum of **1,000 network transactions** will be recorded and transmitted per harvest cycle, regardless of how large you configure the event pool.

The default value for the event harvest cycle is 60 seconds. See also [Set max event buffer time](https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/mobile-sdk/set-max-event-buffer-time/) to change the length of the event harvest cycle.

To ensure that the new value is always applied, place this API call in the `applicationDidBecomeActive` iOS lifecycle method.

### Parameters [#parameters]

| Parameter | Type           | Description                                                                                              |
| --------- | -------------- | -------------------------------------------------------------------------------------------------------- |
| `$size`   | `unsigned int` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Examples [#examples]

#### Objective-C [#obj-c]

```objectivec
BOOL poolSizeSet = [NewRelic setMaxEventPoolSize:1000];
```

#### Swift [#swift]

```swift
let poolSizeSet = NewRelic.setMaxEventPoolSize(1000)
```

## Capacitor

### Syntax [#syntax]

```typescript
setMaxEventPoolSize(options: { maxPoolSize: number; }) => void
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter     | Type     | Description                                                                                              |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `maxPoolSize` | `number` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```typescript
NewRelicCapacitorPlugin.setMaxEventPoolSize({ maxPoolSize: 2000 })
```

## Cordova

### Syntax [#syntax]

```typescript
setMaxEventPoolSize(maxSize: number): void;
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter | Type     | Description                                                                                              |
| --------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `maxSize` | `number` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```js
NewRelic.setMaxEventPoolSize(2000);
```

## .NET MAUI

### Syntax [#syntax]

```csharp
SetMaxEventPoolSize(int maxPoolSize): void;
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter     | Type  | Description                                                                                              |
| ------------- | ----- | -------------------------------------------------------------------------------------------------------- |
| `maxPoolSize` | `int` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```csharp
CrossNewRelic.Current.SetMaxEventPoolSize(1500);
```

## Flutter

### Syntax [#syntax]

```typescript
setMaxEventPoolSize(int maxSize): void;
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter | Type  | Description                                                                                              |
| --------- | ----- | -------------------------------------------------------------------------------------------------------- |
| `maxSize` | `int` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```dart
NewrelicMobile.instance.setMaxEventPoolSize(10000);
```

## React Native

### Syntax [#syntax]

```js
setMaxEventPoolSize(maxSize: number): void;
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter | Type     | Description                                                                                              |
| --------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `maxSize` | `number` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```js
NewRelic.setMaxEventPoolSize(2000);
```

## Unity

### Syntax [#syntax]

```csharp
SetMaxEventPoolSize(int maxPoolSize): void;
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter     | Type  | Description                                                                                              |
| ------------- | ----- | -------------------------------------------------------------------------------------------------------- |
| `maxPoolSize` | `int` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```csharp
NewRelicAgent.SetMaxEventPoolSize(1500);
```

## Unreal Engine

### Syntax [#syntax]

```cpp
setMaxEventPoolSize(int64 maxSize): void;
```

### Description [#description]

Sets the maximum size of the event pool stored in memory until the next harvest cycle. Default is a maximum of 1000 events per event harvest cycle. When the pool size limit is reached, the agent will start sampling events, discarding some new and old, until the pool of events is sent in the next harvest cycle.

### Parameters [#parameters]

| Parameter | Type  | Description                                                                                              |
| --------- | ----- | -------------------------------------------------------------------------------------------------------- |
| `maxSize` | `int` | Required. The maximum number of events that can be buffered in memory before they are sent to New Relic. |

### Example [#example]

```cpp
#include "NewRelicBPLibrary.h"

UNewRelicBPLibrary::setMaxEventPoolSize(2000);
```
