Re: [squirrelfish] C API for reporting extra memory cost
Any opinions on exposing this functionality in the C API? Is it too low-level / implementation-dependent?
Hi Kent, My feeling would be that this is a little implementation dependent. These functions really only exist because our GC only supports fixed sized objects – but we are interested in looking at some point at changing our GC implementation to be able to able to allocate arbitrary sized objects on the GC heap. This would implicitly allow us to better track the additional cost. We could add API to report extra emory cost anyway, and if the heap implementation changed so that we no longer supported this then it would become a no-op, and be deprecated over time.
If exposing reportExtraMemoryCost() as-is is acceptable, I'll go ahead and create the patch. Otherwise, suggestions for alternative approaches are welcome. :)
Depending on the lifecycle of the additional data, one solution might be to add a version of "JSObjectMake", which rather than taking a void* argument could take a size parameter, allocate the storage, and have an output argument to return the additional storage allocated. We could implicitly report the extra cost of this storage, and in the future if we do have the ability in the future to store arbitrary sized objects in the GC heap, then this method could allocate the extra data and the JSObject in a single allocation out of the GC heap, saving the extra malloc. What are your thoughts Geoff? cheers, G.
ext Geoffrey Garen wrote:
What are your thoughts Geoff?
I think this problem has already been solved in JSBasePrivate.h.
Geoff
Wow, I missed that one, thanks. What's the implication of it being in a Private.h? Is this API still going to be supported on the same lines as the public API, or is there a chance of it going away? Kent
What's the implication of it being in a Private.h? Is this API still going to be supported on the same lines as the public API, or is there a chance of it going away?
It's unlikely that it would go away. But it might change before it becomes public. Geoff
ext Geoffrey Garen wrote:
What's the implication of it being in a Private.h? Is this API still going to be supported on the same lines as the public API, or is there a chance of it going away?
It's unlikely that it would go away. But it might change before it becomes public.
Geoff
So to be specific, it would be okay if we use this function in the implementation of Qt API, so long as we're willing to adapt to it changing (which we are)? Like Gavin also pointed out, should the way memory for host objects is managed change, it looks like it would become a no-op in the worst case. Kent
On Mar 4, 2010, at 1:50 AM, Kent Hansen wrote:
ext Geoffrey Garen wrote:
What's the implication of it being in a Private.h? Is this API still going to be supported on the same lines as the public API, or is there a chance of it going away?
It's unlikely that it would go away. But it might change before it becomes public.
Geoff
So to be specific, it would be okay if we use this function in the implementation of Qt API, so long as we're willing to adapt to it changing (which we are)? Like Gavin also pointed out, should the way memory for host objects is managed change, it looks like it would become a no-op in the worst case.
That's probably a good assumption. Basically, that function is something we see a need for in conjunction with the C API, but it has not yet been through Mac OS X API review at Apple, so it is possible that it may change. Regards, Maciej
participants (4)
-
Gavin Barraclough
-
Geoffrey Garen
-
Kent Hansen
-
Maciej Stachowiak