I'm not sure if this counts as writing malicious code. What does the community think?
-
2\$\begingroup\$ I say no. But I have to go so no good reasons yet \$\endgroup\$– user63187Feb 18, 2017 at 23:05
-
\$\begingroup\$ I don't have an opinion at present, but it may be worth considering two things: 1. Are the answers likely to be of any use to people with malicious intent? 2. Will the existence of the challenge give people the impression that malicious code requests are acceptable here? \$\endgroup\$– trichoplax is on Codidact nowFeb 19, 2017 at 0:36
-
\$\begingroup\$ The original malicious code meta post for reference. (not a duplicate - that one doesn't cover how to draw the line between malicious and not malicious) \$\endgroup\$– trichoplax is on Codidact nowFeb 19, 2017 at 0:37
-
\$\begingroup\$ Related \$\endgroup\$– mbomb007Feb 19, 2017 at 1:24
1 Answer
A small, finite memory leak is not malicious
Using up all a computer's memory is a denial of service attack, and thus arguably malicious (although it's something that's easily done by mistake and easily done intentionally, and also has many existing safeguards against it, so PPCG wouldn't really be helping any malware authors there). But that's this question, which is a different question.
Wasting a small amount of a computer's memory in a way that can't be recovered until the program ends is, on most operating systems, entirely harmless, and something that nonmalicious programs do all the time intentionally. (After all, keeping the memory allocated but nonleaked has exactly the same effect on other processes.) It would be potentially problematic on operating systems like DOS, in which a memory leak makes the memory unusable until the system is rebooted (!), but those systems are in the minority nowadays (and DOS users are likely used to rebooting fairly often anyway).