Skip to content

Tools for tracking memory "leaks" #38

@hadley

Description

@hadley

obj_size() provides the basic structure for the recursion. The main difference would be that each call returns a nested list containing the current object, and a (potentially named) list of its children. Would want options to control the maximum depth to recurse (so you could explore iteratively, if needed), whether or not to show CHARSXPs, and how to handle ALTREP. By default, would show environments in the same way as lists, rather than exposing the details of their internal hash tables (but needs option to show full details for debugging other code).

Need small S3 class to capture an object — it's address (string), type (string), NAMED (integer?), and id (integer, if seen before, NULL otherwise), and its children (named list). Its print method would take care of generating the tree display.

This would effectively become a replacement for .Internal(inspect(x)), with a better display (i.e. using colour and unicode tree characters) and displaying a spanning tree (instead of potentially getting stuck in infinite loops). Would replace internal obj_formals() etc, and altrep().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions