undo-limit

undo-limit is a variable defined in `C source code'.
Its value is
80000


Documentation:
Keep no more undo information once it exceeds this size.
This limit is applied when garbage collection happens.
When a previous command increases the total undo list size past this
value, the earlier commands that came before it are forgotten.

The size is counted as the number of bytes occupied,
which includes both saved text and other data.

You can customize this variable.