Forum Discussion

Oak-Beard's avatar
Oak-Beard
Visitor
11 years ago

monitoring the refcnt

Is it possible via the debugger to print the refcnt for an arbitrary variable? If I put a stop statement in my code the debugger will show the refcnt for the immediate scope:
 
Local Variables:
cpx roAssociativeArray refcnt=4 count:20
global rotINTERFACE:ifGlobal
m roAssociativeArray refcnt=5 count:11
port <uninitialized>

The problem is that if i want to examine the contents of one the roAssociativeArrays I won't see the refcnt of it's contents. For example, i have defined an array 'cpx' that has as one entry a roScreen. Printing the array will not provide the 'refcnt' for the screen:

BrightScript Debugger> print cpx
grid: <Component: roAssociativeArray>
port: <Component: roMessagePort>
activeslotcnt: 3
screen: <Component: roScreen>

Is there any way I can get this info?
Thanks

3 Replies

  • "Oak-Beard" wrote:
    Is it possible via the debugger to print the refcnt for an arbitrary variable? If I put a stop statement in my code the debugger will show the refcnt for the immediate scope:
     
    Local Variables:
    cpx roAssociativeArray refcnt=4 count:20
    global rotINTERFACE:ifGlobal
    m roAssociativeArray refcnt=5 count:11
    port <uninitialized>

    The problem is that if i want to examine the contents of one the roAssociativeArrays I won't see the refcnt of it's contents. For example, i have defined an array 'cpx' that has as one entry a roScreen. Printing the array will not provide the 'refcnt' for the screen:

    BrightScript Debugger> print cpx
    grid: <Component: roAssociativeArray>
    port: <Component: roMessagePort>
    activeslotcnt: 3
    screen: <Component: roScreen>

    Is there any way I can get this info?
    Thanks


    Once in the debugger, you can assign an element of the AA to a temporary variable then use the `var` command to print the variables again. Something like:

    BrightScript Debugger> myVar = cpx.grid
    BrightScript Debugger> var


    That should now print 'myVar' with a refcnt (increased by 1 for the local var).