# with_memory_limit

Set memory limit for the container.

```rhai
container.with_memory_limit(memory) -> Container
```

## Parameters

- `memory` (string): Memory limit with unit (e.g., "512m", "2g")

## Returns

Returns the `Container` builder for method chaining.

## Examples

```rhai
// Limit to 512 megabytes
let container = nerdctl_container_from_image("app", "myapp:latest")
    .with_memory_limit("512m")
    .with_cpu_limit("1")
    .build();

// Limit to 2 gigabytes
let container2 = nerdctl_container_from_image("db", "postgres:latest")
    .with_memory_limit("2g")
    .build();
```

## Notes

- This is a chainable method
- Units: b, k, m, g (bytes, kilobytes, megabytes, gigabytes)
- Use `with_memory_swap_limit()` to set swap limit
