The gap limit is the maximum number of consecutive unused addresses in your deterministic sequence of addresses. Electrum uses a gap limit to stop looking for addresses, it is set to 5 by default, so the client get all addresses until 5 unused addresses are found.
If you used a different gap limit when creating the addresses, then you need to keep record of it or remember it. Addresses that appeared beyond the gap limit won't be found unless you set the gap limit you used.
For example: Using MPK on a web server you used gap limit 40 to create 40 addresses for your web store. Then you had 39 open orders that are not paid and the address number 40 has a payment.
When you restore with gap limit 5 (default in the client) you'll have 5 unused empty addresses, you won't see the other 34 that are also unused but related to open orders neither you'll see or have balance for the address number 40 that has a payment on it.