11
\$\begingroup\$

This concerns this currently deleted question.(*) My opinion is that a program getting out of memory after 3 hours is basically working. It may not be good enough for what's required, but it's exactly as broken as a code too slow for what's required. In the first case you see a crash, in the second you see it running "forever".

With smaller requirements it may work well. It's not fundamentally broken, it's just not good enough.

There may be a bug causing this, but we can't tell it without reviewing it first. I tried to vote to undelete, but it's a moderator's decision.


(*) This question has been basically copied to SO.

\$\endgroup\$
20
\$\begingroup\$

In my opinion, programs that run out of memory with large inputs are in the spirit of Code Review (assuming that everything else about the question is OK). Performance and scalability are among the key concerns we frequently address. I don't see running out of memory as much different from — they are related problems in the space-time continuum. Since we allow questions, we should also allow questions about where the program runs out of memory.

That said, the author of the question should make some effort to demonstrate that the program works correctly with small inputs, and the question should be primarily about improving the code, not about how to tweak heap size settings. That configuration issue was best addressed on Stack Overflow. I deleted the question on Code Review since the author cross-posted it on Stack Overflow.

I've undeleted the question on Code Review and edited it to put the focus on the code rather than the configuration issue.

\$\endgroup\$
  • \$\begingroup\$ Thanks for undeleting! The problem with the SO question is that the OP initially didn't understand my comment concerning eclipse.ini, so I repeated it there... and the chance to get an answer on the real problem got lost. \$\endgroup\$ – maaartinus Jun 20 '15 at 5:39
4
\$\begingroup\$

Note: I can not read the question, so my answer is based on the information given by the OP.

Code on CodeReview should work to the best knowledge of the OP. If the objective of the code is to handle 500 kB at most but the code crashes at 2 GB, the code is considered working. If those are reversed, it isn't.

Non-working code should not be posted. However, often it's a design flaw causing the lack of extendibility of the code. If the code can be redesigned to be extendible, the 'non-working' part of the code is no longer a problem.

In my opinion it's a grey area. The decision should be made based on the wording of the question and perhaps even on the amount of cooperation given by the OP when confronted with the problem.

\$\endgroup\$
  • 2
    \$\begingroup\$ Now it's undeleted. The objective is usually pretty subjective: It does what I wrote it for and now I want more. Or the other way round. +++ I wouldn't consider the wording important as it can lead to punishing honesty. \$\endgroup\$ – maaartinus Jun 20 '15 at 5:44
  • \$\begingroup\$ In my opinion, if the code is the same and the answers would be the same, then the details of how the question is formulated doesn't matter. \$\endgroup\$ – Simon Forsberg Dec 26 '16 at 21:39
  • \$\begingroup\$ I fail to see how the cooperation of the OP is relevant to determining if the question is on-topic or not. It should be based on the question itself, not the person behind the question. \$\endgroup\$ – Simon Forsberg Dec 26 '16 at 21:40
  • 1
    \$\begingroup\$ @SimonForsberg If you go down that route, you're basically stating the intent of the code is irrelevant. The context becomes irrelevant. All of a sudden we no longer care about specifics and will allow example code. Either code solves the problem or it doesn't. That distinction is important. \$\endgroup\$ – Mast Dec 26 '16 at 21:40
  • \$\begingroup\$ I didn't say the intent of the code is irrelevant. What I mean is that saying "How do I fix this OutOfMemory issue?" or saying "How can I improve my code to be more memory efficient" is irrelevant. The code in the question would be the same and the answer to both the questions is the same. \$\endgroup\$ – Simon Forsberg Dec 26 '16 at 21:43
  • \$\begingroup\$ @SimonForsberg That would be true if the code would work for the cases given. Which it doesn't if there's an Out Of Memory error. A TLE can be caused by an overly critical judge. OOM is an exception thrown by the environment itself. That's a big difference. \$\endgroup\$ – Mast Dec 26 '16 at 21:49
  • 1
    \$\begingroup\$ @Mast What about an overly critical environment? i.e. an environment with not enough memory available or too low max heap setting? To me it is no difference. It's still about resources (CPU time and Memory) \$\endgroup\$ – Simon Forsberg Dec 26 '16 at 21:57

You must log in to answer this question.

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