Flash: Deviating upper limits


When using the Mbed CLI to compile applications for the nRF52840 (1MB Flash), the compiler produces flash overflow error when exceeding around 901.288 B. When doing the same for the DISCO-F413ZH (1.5MB Flash), the compiler does the same exceeding around 1.564.718 B. The latter is much closer to the given Flash. Why is this the case?