Saturday, February 25, 2012

Buffer Leaks

I've had this a few times.

Can someone explain what a buffer leak is, and how are they avoided.

I downloaded the ExtraSort demo and in non-debug mode I get loads of errors saying the buffer leaked?

How do I plug the whole? Do I need a big cork?

Simon

Well there are 2 leak messages the buffer manager gives and since you didn't specify the exact message I don't know which one you are getting and they happen in very different scenarios. I will explain them both but they are both a component coding error.

1. This buffer has been orphaned...
This is when the engine is shutting down but a component still has a reference to a buffer. This usually mean the component has actually leaked a buffer since when the engine is shutting down everything else in the dataflow has already finished.

2. A call to ProcessInput unexpectedly kept a reference...
This is when a component calls AddRef on a buffer that it was passed in a process input call. This is not allowed. A component that needs to keep a buffer around that it was passed on process input must call clone on the buffer not addref.

You can't do anything about this problem. The component author must fix their component to resolve these problems.

HTH,
Matt

No comments:

Post a Comment