2 ms·
But the article states "Anything you create with new is always created on the heap."
by MaxBarraclough 8y ago
But the article states "Anything you create with new is always created on the heap."
- mhaymo 8y agoYes, but it then explains that escape analysis allows the runtime to avoid creating the Object entirely with scalar replacement. It's written in a confusing way, which is why I felt the need to clarify.
- MaxBarraclough 8y agoUgh, you're right, of course. In my defence the sentence I quoted isn't so much deliberately misleading, as outright false. It essentially states that 'new' always results in a heap allocation, which just isn't true. A profoundly unhelpful writing style, going out of its way to punish skim-readers. I'm reminded of this TV Tropes page: http://tvtropes.org/pmwiki/pmwiki.php/Main/ByNoIMeanYes http://tvtropes.org/pmwiki/pmwiki.php/Main/ByNoIMeanYes