Java moves to copying for substrings

Brian Schott briancschott at gmail.com
Tue Nov 19 11:37:24 PST 2013


On Tuesday, 19 November 2013 at 10:38:06 UTC, Jonathan M Davis 
wrote:
> It _is_ true however that if you're not careful about it, you 
> can end up with
> a lot of slices that keep whole blocks of memory from being 
> collected when
> they don't really need to refer to that memory anymore. So, 
> depending on what
> profiling shows, some applications may need to make adjustments 
> to avoid having
> slices keep too much extraneous memory from being collected. 
> So, it's
> something to keep in mind, but I defintely don't think that we 
> should be
> changing our approach at all.
>
> - Jonathan M Davis

I ended up doing this in DCD. The lexing step sliced the source 
code, so when caching autocompletion information for all of 
Phobos, Druntime, etc, the memory usage would get fairly large. 
Adding a few ".dup" calls in the phase that converts the AST to 
the autocompletion cache structures greatly reduced the memory 
usage.


More information about the Digitalmars-d mailing list