Skip to main content
24 events
when toggle format what by license comment
Nov 7, 2020 at 21:45 vote accept panlex
Jun 30, 2018 at 13:03 history protected gnat
Jun 30, 2018 at 8:50 comment added kamikaze @kamikaze Or thinking about it, I guess it's just one pointer to the vtable per class. A cost that cannot be avoided in Java, so I guess methods don't cost extra (because you always pay for them). I guess in C++ you can avoid that one extra pointer cost by having no virtual methods.
Jun 30, 2018 at 8:38 comment added kamikaze What nobody seems to see, virtual methods cost one pointer per object each. In a language like Java where all methods are virtual, the cost can be significant.
Jun 30, 2018 at 7:02 answer added Jamy Spencer timeline score: 0
Apr 12, 2017 at 7:31 history edited CommunityBot
replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Jan 6, 2016 at 23:33 answer added Christophe timeline score: 2
Jan 5, 2016 at 13:27 history tweeted twitter.com/StackProgrammer/status/684365688262230017
Jan 4, 2016 at 10:40 comment added JacquesB @lxrec: Even with the JS-antpattern you describe, the code of the method is not copied to every instance, only a reference to the function object. So the memory overhead will still be tiny.
Jan 4, 2016 at 10:39 comment added Pieter B @JacquesB it was meant semiseriously.
Jan 4, 2016 at 10:34 comment added JacquesB @PieterB: Are you suggesting DI is so great it can even solve problems which doesn't exist in the first place?
Jan 4, 2016 at 10:08 answer added gnasher729 timeline score: 3
S Jan 3, 2016 at 21:26 history suggested Martin Schröder CC BY-SA 3.0
fix markup
Jan 3, 2016 at 20:21 review Suggested edits
S Jan 3, 2016 at 21:26
Jan 3, 2016 at 14:28 comment added Pieter B Ins't the answer to every OO related question: Dependency Injection? If you're bothered about the memory overhead you could just design a "saver" object of which you make one instance, that can be injected....
Jan 3, 2016 at 13:51 comment added Bryan Oakley Have you considered writing a small program that creates thousands of such objects and doing the measurements yourself?
Jan 3, 2016 at 13:38 answer added user204677 timeline score: 7
Jan 3, 2016 at 13:27 comment added Ixrec The only language I know of where you could get this memory-wasting behavior is Javascript, but even then you'd have to completely fail at prototypal OO to do it. What you're supposed to do in JS is put (both static and non-static) methods on the prototype object, so that all objects inheriting from that prototype will share that one function without any duplication.
Jan 3, 2016 at 13:24 history edited Ixrec CC BY-SA 3.0
More descriptive title
Jan 3, 2016 at 6:37 comment added Matthew Mark Miller Well, it might happen with some dynamic language in its infancy, or as a side effect of abused reflection. But in general, no, a Byte isn't going to be much larger than the byte it contains.
Jan 3, 2016 at 4:50 answer added vrostu timeline score: 25
Jan 3, 2016 at 4:22 comment added joshp In what language are you thinking that the code is duplicated for each instance? This doesn't happen in Java, C#, C++.
Jan 3, 2016 at 4:14 review First posts
Jan 3, 2016 at 13:29
Jan 3, 2016 at 4:13 history asked panlex CC BY-SA 3.0