Author Topic: "Garbage collecting" BASS objects  (Read 1018 times)

Bellhop

  • Posts: 41
"Garbage collecting" BASS objects
« on: 1 Mar '12 - 14:05 »
Is there an accepted way to "garbage collect" orphaned objects created in BASS? For example, "x" streams are created, but only "x - 1" streams are freed. Although I'm taking every care to clean up objects after use, this application will run unattended for long periods of time and well, stuff happens. I'm working from vb.NET but of course, BASS objects are unknown to .NET. Before I re-invent the wheel, I thought that I would check to see if this problem had already been addressed.

radio42

  • Posts: 4576
Re: "Garbage collecting" BASS objects
« Reply #1 on: 1 Mar '12 - 18:52 »
There shouldn't be any real problem.
BASS is native code (unmanaged).
So when you create a stream, you MUST take care by yourself to also free it.
This is pretty must as if you would open a file and forget to close it.
There is nothing BASS or .Net can do about, since it lies in your applications responsibility to do so, as nobody else would know, if you still want to use a created stream handle or not.

Bellhop

  • Posts: 41
Re: "Garbage collecting" BASS objects
« Reply #2 on: 1 Mar '12 - 19:29 »
 :-\ That's understood, "radio42". I do have software in place to track what I'm using and to remove what I'm finished with. I would also like something that could search for things and remove those things that don't have a reason to exist. Should my "list" of "stuff" become corrupted, then I need a way to recover.

I thought that I would post to see if someone has already done this thing before I set out to write my own from scratch.