Go-lxc: Recommended Usage of c.Release()

In go-lxc, I see a Release function, that decrements a reference count. Its said to release resources. I’m not sure what it really does, because the start.go program starts up an instance, and does a deferred call to Release(), and when that program’s over the instance is up and healthy, so nothing critical seems to be getting released. What is it releasing?

Release() calls container_put in the C API which decrements the refcount for the container struct, when it reaches 0, the struct is freeed by liblxc.

Forgetting to run Release() after you’re done with the container struct in Go will lead to a memory leak in liblxc.

Thanks. I’m still looking at nomad’s lxc driver. (I’ve been out-of-town and offline for a few weeks). That driver needs some work. It looks like this is another one of the problems.

@Brian_McQueen i am also looking into nomad and lxc. In fact i started working a bit on the driver and filed recently two pullrequests. I added support for using lxcbr0 instead of sharing the host network. For now i did not get any feedback from the current maintainer, though.
Next i will work on exec support and i’ll add a parameter to optionally invoke a in-container tool when nomad stops a container. Aside from bug fixes, what do you expect from an enhanced nomad driver?

We should continue this somewhere else. I don’t think the community wants this thread at the top as you and I discuss this. I saw your PR and it looks like you’re going where I want to go with the nomad driver. Any good ideas for where to continue this discussion? Email would be fine. Maybe we should go to the mailing list. Or a nomad mailing list. I want to discuss this today in fact.

I made a gitter here