How much memory is used by an object?

Jacob Carlborg doob at me.com
Mon Feb 18 12:04:38 PST 2013


On 2013-02-18 17:13, Alexandr Druzhinin wrote:

> and this the next problem I get - the application eats memory always. in
> C++ I'd say it is leaks but with gc I'm not sure it is - I guess gc
> collects memory but I don't see in reality. I think I don't understand
> something important and now I read from the start.

The GC works like this:

1. Request memory
2. No memory is available
3. Run a collect cycle
4. If memory still isn't available allocate more from the OS

When it runs a collect it will keep the memory so it can used it for 
future allocations instead of give it back to the OS.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list