[Issue 10323] getAMDcacheinfo needlessly allocates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 10 13:21:09 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10323



--- Comment #2 from Adam D. Ruppe <destructionator at gmail.com> 2013-06-10 13:21:06 PDT ---
Well, they don't *always* allocate - in the variable is static, they don't. But
if not they do and that sucks. I'm pretty sure it is a well known issue and
this bug seems close: http://d.puremagic.com/issues/show_bug.cgi?id=6421 but is
talking about static so not sure.

Bugzilla search never works easily for me :(

My preferred solution to the array literal question is if the contents are all
literal values too (or, ideally, if they can evaluate to literals with CTFE),
put the literal into static data like you would with a string literal. Well,
maybe not like a string literal, since they are read only and arrays expect to
be writable. Maybe put them in the initialized data segment instead, with
read/write.

Then only do a runtime allocation if the literal isn't all literals, e.g. "int
x = 10; auto b = [x, 100];", b would be an ok allocation because x is a runtime
value.


Nevertheless, in druntime we should be mindful of it and at least mark these
arrays static so they work today, pending an answer to the bigger question.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list