Ok, nevermind, I think I found your issue. You also need to remove the source 
from the `dyn_sources` list, otherwise it never gets garbage collected. Just 
add `dyn_sources := list.remove_assoc(uri,!dyn_sources)` to your script:

```
set("server.telnet", true)

dyn_sources = ref []

def add_source(uri) =
  url = mksafe(input.http("http://illestrater.com:1337/#{uri}";))
  source = output.icecast(
    %mp3(bitrate=128),
    mount="#{uri}-mp3",
    host="illestrater.com",
    port=1337,
    password="*******",
    fallible=true
  )

  output = source(url)

  dyn_sources := 
      list.append( [(uri, output)],
                    !dyn_sources )
  "transcoding #{uri}"
end

def remove_source(uri) =
  def search(x, y) =
    current_uri = fst(y)
    if current_uri == uri then
      test = snd(y)
      source.shutdown(test)
      (["#{uri} closed"])
    else
      ([])
    end
  end
  result = list.fold(search, ([]), !dyn_sources)
  dyn_sources := list.remove_assoc(uri,!dyn_sources)
  "#{result}"
end

server.register(namespace="sources",
                description="Start a new dynamic playlist.",
                usage="add <uri>",
                "add",
                add_source)
server.register(namespace="sources",
                description="Start a new dynamic playlist.",
                usage="remove <uri>",
                "remove",
                remove_source)

output.dummy(blank())
```

If you set the log level to `4`, you can monitor the garbage collection calls 
and you should see your dynamic sources get cleaned up. It might not happen 
immediately, though, but as memory grows, the application will eventually 
reclaim their memory.

I'm closing here since I believe that was the issue. Please reopen if you still 
see an issue.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/savonet/liquidsoap/issues/628#issuecomment-437588860
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to