Simplify memory handling

Open
#437 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
lua
Domain
tooling

Research direction

Start with the scanner implementation and the linked watchman.lua weak-table usage, then read the related sections of ARCHITECTURE.md. Determine how the scanner currently handles owned and unowned slabs and what cleanup callbacks would need to cover. Done means memory cleanup is more uniform and the weak table can be removed if the design supports it.

Written by the indexing model from the issue text.

Description

Not sure if this will be any better but teach the scanner "class" to take a pointer to a cleanup function and a void * pointer to be passed to it.

We would pass perhaps three different kinds of function to it. One would just free owned slabs passed in from elsewhere, the other would not free unowned slabs but instead call a deallocation function for the thing that does own them (eg. a watchman response instance, for example). The other (perhaps the same as the first) would free owned slabs the scanner itself had created.

The idea of all this is to make things more uniform and consistent, and perhaps allow us to get rid of the ghastly weak table[^weak].

[^weak]: See description of where it is used and description of big picture.

Dominant language
Lua
Stars
2.8k
Forks
317
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

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.

More from wincent/command-t

All issues in wincent/command-t

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.