Iterate over all heap instances? [message #537582] |
Wed, 02 June 2010 22:08  |
Eclipse User |
|
|
|
Is there a way to, at runtime, iterate over all heap instances?
My concrete use case is to periodically call Memory_getStats() on all heap instances to determine the memory usage in my app, as well as detect any memory leaks when it completes. The first arg to Memory_getStats() is a heap instance handle, so I'm looking to enumerate all the heap instance handles and call Memory_getStats() on each one.
Thanks.
|
|
|
|
|
Re: Iterate over all heap instances? [message #537871 is a reply to message #537815] |
Thu, 03 June 2010 20:05   |
Eclipse User |
|
|
|
On 6/3/2010 10:45 AM, Chris Ring wrote:
> Thanks. Doesn't quite meet my use case, though. By design(!) I have no
> idea what Modules will in my system when I compile my library.
>
> Maybe I can, in my meta-only module's .xdt file, loop over all Modules
> in the system that inherit from IHeap and somehow generate a function
> that does what I need. (I can't find all Modules that inherit from IHeap
> at runtime, can I?)
Right (and Right)
>
> Given all the <Mod>'s that inherit IHeap, I guess I can then use
> <Mod>_Object_first()/next() for any dynamic instances and
> <Mod>_Object_count()/get() for the static instances. Given all that, I
> could probably call this autogenerated fxn.
Right.
>
> Any other suggestions? This isn't trivial to put together, and if
> there's an easier way, I'm looking for it. :roll: Thanks in advance.
Unfortunately, there is no better way today. Although it is possible to
create the data structures to scan all instances that are created by
modules that inherit a specific interface this would result in a fair
amount of data in systems that don't need (and can't afford) the overhead.
Obviously this can can a configurable option. Contributions are welcome.
|
|
|
Re: Iterate over all heap instances? [message #538052 is a reply to message #537582] |
Fri, 04 June 2010 12:52  |
Eclipse User |
|
|
|
FWIW: The first heap example in the RTSC-pedia illustrates a technique
for monitoring memory and checking for memory leaks/overflow and uses
the Object_get() methods to loop over all instances of a heap module:
http://rtsc.eclipse.org/docs-tip/Extending_xdc.runtime_Memor y/Example_1
On 6/2/2010 7:08 PM, Chris Ring wrote:
> Is there a way to, at runtime, iterate over all heap instances?
>
> My concrete use case is to periodically call Memory_getStats() on all
> heap instances to determine the memory usage in my app, as well as
> detect any memory leaks when it completes. The first arg to
> Memory_getStats() is a heap instance handle, so I'm looking to enumerate
> all the heap instance handles and call Memory_getStats() on each one.
>
> Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.51263 seconds