2
\$\begingroup\$

Should programs that may run out of memory be allowed? For example, when validating data to see if it's a valid PNG file or not, as per this challenge.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ I think you need to distinguish several cases here: a) will run out of memory for any valid input before producing the result, b) will run out of memory randomly, c) will run out of memory for sufficiently large inputs, d) will run out of memory eventually on infinite-output challenges, but will produce results until then. There may be more cases. There's also the question of "may run out of memory on which machine"? \$\endgroup\$ Commented Nov 28, 2016 at 14:39
  • \$\begingroup\$ @MartinEnder It may run out of memory if you give it a valid invalid input (an input which should validate to invalid/false). \$\endgroup\$
    – SoniEx2
    Commented Nov 28, 2016 at 14:42
  • \$\begingroup\$ @SoniEx2 May run out of memory, or Will run out of memory for specific inputs? is it a compiler limitation or a hardware limitation? \$\endgroup\$
    – tuskiomi
    Commented Nov 28, 2016 at 17:18
  • \$\begingroup\$ @tuskiomi May run out of memory if you don't give it enough RAM Because Java.. \$\endgroup\$
    – SoniEx2
    Commented Nov 28, 2016 at 17:32

1 Answer 1

2
\$\begingroup\$

My thoughts:

If there are valid inputs for which the program will always run out of memory, then the program doesn't work for those inputs and isn't a valid solution. If you can solve the problem by throwing more memory into your system, then it's a hardware problem and theoretically, years down the line, the solution will function normally on most common systems, and this should be allowed.

Whether or not the program is allowed to run out of memory after a result has been given should be dependent on if the challenge allows the program to have errors, which is true in most cases.

On challenges that require the program to output infinitely, the program should always be able to generate more output given additional memory.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .