Conspiracy Theory #1

Travis Boucher boucher.travis at gmail.com
Sat Nov 21 07:33:23 PST 2009


Nick Sabalausky wrote:
> "dsimcha" <dsimcha at yahoo.com> wrote in message 
> news:he6aah$4d6$1 at digitalmars.com...
>> == Quote from Denis Koroskin (2korden at gmail.com)'s article
>>> Aren't uint array allocations have hasPointers flag set off? I always
>>> thought they aren't scanned for pointers (unlike, say, void[]).
>> Right, but they can still be the target of false pointers.  In this case, 
>> false
>> pointers keep each instance of foo[] alive, leading to severe memory 
>> leaks.
> 
> I don't suppose there's a way to lookup the pointers the GC believes it has 
> found to a given piece of GC-ed memory? Sounds like that would be very 
> useful, if not essential, for debugging/optimizing memory usage.
> 
> 

Maybe extend the GC interface so the compiler and language in general 
will give hints on what the memory is being used for.  This could even 
be extended to application code as well.

MEM_OBJECT, MEM_STRUCT, MEM_PTRARRY, MEM_ARRAY, etc. (I haven't fully 
thought this through so these examples may be bad).

Then the GC implementations can decide how to allocate the memory in the 
  best way for the underlying architecture.  I know this would be useful 
on weird memory layouts found in embedded machines (NDS for example), 
but could also be extended language-wise to other hardware memory areas. 
  For example, allocating memory on video cards or DSP hardware.

Like I said, this isn't something I have thought through much, and I 
don't know how much (if any) compiler/GC interface support would be 
required.



More information about the Digitalmars-d mailing list