Yes, using profiling API for this task isn't appropriate, because all
the data for heap profiling is gathered during GC cycles.

I think, introducing a dedicated V8 API call is the most
straightforward solution.

On Thu, Oct 8, 2009 at 02:48, [email protected] <[email protected]> wrote:
>
> Hi,
>
> I'd like to query the amount of memory allocated from the OS for the
> V8 heap as well as the amount of bytes occupied by allocated objects
> within the heap.  Currently, there is a heap profiler API but it seems
> much too heavyweight for this use case and I would be wary of leaving
> it on all the time.  It is also possible to call V8::SetCounterFunction
> () and then sniff for updates to the "c:V8.OsMemoryAllocated" and
> related counters, but this seems very brittle.  I am not aware of any
> other ways to get this information directly and I would propose an API
> that looked something like this be added to class V8:
>
> static void GetHeapStatistics(size_t* os_memory_allocated, size_t*
> memory_in_use);
>
> My use case is that in Chromium's task manager it would be nice to
> know how much of the memory footprint of a given renderer process is
> due to V8's heap.  Fields within the task manager are populated by
> polling each process at about 1Hz.
>
> Does this sound reasonable?
>
> - James
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to