[dmd-internals] Struct initialization in nested functions

Brad Roberts braddr at puremagic.com
Fri Jan 18 01:50:07 PST 2013


On 1/18/2013 1:22 AM, Maxim Fomin wrote:
> 
> 
> 2013/1/18 Brad Roberts <braddr at puremagic.com <mailto:braddr at puremagic.com>>
> 
>     On 1/17/2013 2:13 PM, Maxim Fomin wrote:
>     > Are you debugging this on OSX?
>     >
>     > In linux these three runs fine and throws exceptions because of absent URL.
>     > However after adding "dlang.org <http://dlang.org> <http://dlang.org>" argument in each of three cases to watch
>     performance,
>     > valgrind shows memory errors which are finally detected in druntime (gc.gcx.mark, gc.gcx.findpool, etc.),
>     > so there is something wrong with curl module or druntime.
>     >
>     > Does valgrind detect errors in your installation for #1 and #3?
> 
>     It's been a while since I looked at valgrind + the gc but when I did, the only 'issues' that I saw were when the stack
>     walk touched portions of the stack that had never been written to (which is perfectly valid behavior).
> 
> 
> Error messages are: "Conditional jump or move depends on uninitialised value(s)" and "Use of uninitialised value of size 8",
> so this invalid behavior. BTW, curl sample written in C does not cause these errors.

Right, the gc looks at a portion of the stack to decide if it needs to mark a portion of memory as referenced.  If that
stack slot has never been written to (maybe it's open for alignment padding, or any other reason), the use of that data
is going to trigger those warnings.  It's not _invalid_, it's just the nature of conservative garbage collection at work.



More information about the dmd-internals mailing list