D on next-gen consoles and for game development
deadalnix
deadalnix at gmail.com
Fri May 24 21:57:48 PDT 2013
On Saturday, 25 May 2013 at 01:26:19 UTC, Manu wrote:
> Freeing is a no-realtime-cost operation, since memory
> management is usually
> scheduled for between-scenes, or passed to other threads.
> And I've never heard of a major title that uses smart pointers,
> and assigns
> them around the place at runtime.
> I'm accustomed to memory management having a virtually zero
> cost at runtime.
> So I don't think it's biased at all (in the sense you say), I
> think I'm
> being quite reasonable.
>
Same goes for the GC, if you don't allocate, it wont trigger.
>
> How much floating garbage? This might be acceptable... I don't
> know enough
> about it.
>
It about how much garbage you produce while the GC is collecting.
This won't be collected before the next cycle. You say you don't
generate a lot of garbage, so the cost should be pretty low.
> That is a easy way to export a part of the load in another
> thread,
>> improving concurrency in the application with little effort.
>>
>
> Are you saying a concurrent GC would operate exclusively in
> another thread?
> How does it scan the stack of all other threads?
>
> With real time constraint, a memory overhead is better than a
> pause.
>
Yes, it imply a pause to scan stack/registers, but then the
thread can live it's life and the heap get scanned/collected. You
never need to stop the world.
> I wouldn't necessarily agree. Depends on the magnitude of each.
> What sort of magnitude are we talking?
> If you had 64mb of ram, and no virtual memory, would you be
> happy to
> sacrifice 20% of it? 5% of it?
>
They are so many different variations here with each pro and
cons. Hard to give some hard numbers. In non VM code, you have
basically 2 choices :
- Tax on every pointer write and check a flag to know if some
operations are needed. if the flag is true, you mark the old
value as a root to the GC.
- Only while collecting using page protection (seems like a
better option for you as you'll not be collecting that much). The
cost is way higher when collecting, but it is free when you
aren't.
> Right. But what's the overhead of a scan process (that's almost
> entirely
> redundant work)?
Roughly proportional to the live set of object you have. It is
triggered when your heap grow past a certain limit.
More information about the Digitalmars-d
mailing list