mgedmin / mgedmin/objgraph

objgraph.by_type('file', untracked=True)

Open
#2 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
840
Forks
72
PR merge metrics
No merged PRs in 30d

Description

So, not all objects are tracked by the Python garbage collector, and therefore not all show up in `gc.get_objects()`. For example: file objecs don't, so objgraph.by_type('file') will always return an empty list.

Implement a workaround that does

```
return [r for o in objects for r in gc.get_referents(o) if type(r).__name__ == typename]
```

if the user asks for it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of objgraph.by_type and its existing tests. Compare current behavior with the requested untracked option, using the issue's gc.get_referents example as the expected behavior. Done means the option returns matching objects that are not included by gc.get_objects(), while existing behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.