---
title: std.count
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/miscellaneous/std-count
---

```
INTEGER std.count(ID collection)
```

**Available in:** all subroutines

Count the number of objects inside the given collection.

## Example

```vcl
sub vcl_recv {
  set req.http.Number-of-Headers = std.count(req.headers);
}
```

> **WARNING:** Except when used to count collections of HTTP headers (such as 
> [req.headers](https://www.fastly.com/documentation/reference/vcl/variables/client-request/req-headers/)),
> this function consumes workspace memory equal to the size of the collection 
> being counted. While debugging [memory overflow](https://www.fastly.com/documentation/guides/vcl/errors/#memory-overflows)
> errors, beware that calling this function can itself cause or contribute to 
> these sorts of problems.
