Skip to content

Be able to clean-up Logs.Src.list #59

@dinosaure

Description

@dinosaure

Currently, when a source is created, it is stored in a global list. If a program attempts to create multiple sources "on the fly" based on dynamic parameters such as:

let gen () =
  let v = Atomic.make 0 in
  fun () -> Atomic.fetch_and_add v

(* spawn every time a new client arrive. *)
let handler_client () =
  let src = Logs.Src.create (Fmt.str "client-%08x" (gen ()) in
  do_stuff ~src ()

We end up with a bunch of sources that may be unused but are still kept in memory. It may be useful to either have a way to delete a source as soon as it is no longer needed (something like lwt-dllist can be useful), or to specify in the documentation that a source will remain active "forever" even if it is no longer used.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions