World-writable memory on Samsung Android phones
Posted Dec 18, 2012 20:28 UTC (Tue) by
nix (subscriber, #2304)
In reply to:
World-writable memory on Samsung Android phones by khim
Parent article:
World-writable memory on Samsung Android phones
I think we're arguing fiercely for the same thing in different words in most areas. However...
It is impossible to do anything in Java without the possibility that the VM will choose to allocate additional memory on the OS or C library level.
Wrong. It's impossible if you use immutable classes like String but quite possible if you'll use char[] instead. If you want to do such transition or not depends on the task in question.
You're wrong, sorry. There are no guarantees at all in the language specification regarding when the VM will choose to allocate memory on the OS or C library level (nor should there be). Thus, you cannot be sure that
anything you choose to do, or not do, in Java will or will not allocate memory on that level, though there are things you can do to roughly influence patterns of allocation and allocation rates. You could perfectly well find that your char[] access caused some VM-internal counter to exceed some threshold and a JIT to be kicked off, which would surely allocate memory on the C library level and quite possibly on the OS level as well. (Indeed, I've seen just this with simple integer additions). So you
must define what you mean when you say 'without using additional memory', or you should expect to be misinterpreted.
A JRE can legitimately start thrashing or run out of OS-level memory (and get killed or throttle itself) while executing nothing on the bytecode level but a loop which adds two numbers together. It's unlikely, but it's possible. And OS-level memory is a form of memory one often cares about running out of, even if you can't control it precisely from the bytecode level or above (though JRE command-line parameters can restrict it to some degree, in some implementations). One also cares about running out of memory on the JRE level, not least so as to avoid running into the artificial limits imposed by those command-line parameters. One also cares about minimizing garbage production rates. These are all different problems, with different solutions and different tradeoffs involved. Yet you just said 'memory' and expected us to tell by telepathy which one you meant. But that depends on what problem you're trying to solve!
It's not your problem.
It bloody well is my problem if I'm one of the candidates your proposed scheme discriminating against! Indeed it has
been my problem for many years. (And I'm not by any means the only person with this problem. It's not incredibly common but it is hardly rare. Yes, most people you'll find applying for jobs in the software community are quite good at interviews -- but that's because those of us who aren't never switch jobs until they become intolerable, and get penalized severely in financial terms for that forced decision.)
(
Log in to post comments)