What are the memory limit and stack size on CodeChef?

I wanted to know the limit of the memory for a single program execution and stack size on CodeChef

1 Like
  1. The limit of the memory for a single program execution is 1.5GB. This limit includes every aspect of memory consumption:

    • stack,
    • heap,
    • memory required by virtual machine (e.g. in Java family languages),
    • memory required by interpreter (e.g. PHP, Python).
  2. The stack size varies for different languages:

    • Java has the limit of 64MB (increased from default value of 1MB),
    • every language that is compiled to the executable file (e.g. C, C++, etc.) has no limit for the stack size, i.e. the stack is (theoretically) limited by the memory limit,
    • for every remaining language (i.e. languages with interpreters or virtual machines) we do not change default stack size limit, i.e. the stack size has default value for the supported version of the compiler.

Please note that the limit may differ between compiler versions. Information about default limits should be available in documentation of languages. Please be aware that interpreted languages can define limits other than “stack limit”. For example, you may expect the “recursion limit” instead of “stack limit”.

6 Likes

Thanks for confirming @admin!!

To know more about stack size and memory layout. Refer this two links:

I don’t want to create a new question, as my question is the same as the title.

However, currently Codechef’s judgement seems to have been updated and the memory limit seems to be larger than before.

The memory limit used to be 1536MB, but now I discovered a C++ Accepted solution using 2208MB (solution ID: 14822944).

How can it be that?

2 Likes

JAVA programs use ~4GB since their update.

This was asked here as well. However, there has been no response from Codechef.