I just received a request for the patch mentioned in this thread so I'm just
going to paste it here for all future users since it doesn't appear there
has been a new release which includes this.

Tell the host application when we no longer need virgin body
so that the host application can get rid of allocated resources and
possibly terminate the transaction.

Index: src/adapter_modifying.cc
===================================================================
--- src/adapter_modifying.cc    (revision 12841)
+++ src/adapter_modifying.cc    (working copy)
@@ -290,21 +290,21 @@
 }
 
 void Adapter::Xaction::abContentShift(size_type size) {
        Must(sendingAb == opOn || sendingAb == opComplete);
        buffer.erase(0, size);
 }
 
 void Adapter::Xaction::noteVbContentDone(bool atEnd)
 {
        Must(receivingVb == opOn);
-       receivingVb = opComplete;
+       stopVb();
        if (sendingAb == opOn) {
                hostx->noteAbContentDone(atEnd);
                sendingAb = opComplete;
        }
 }
 
 void Adapter::Xaction::noteVbContentAvailable()
 {
        Must(receivingVb == opOn);
 
@@ -333,21 +333,21 @@
 }
 
 bool Adapter::Xaction::callable() const {
        return hostx != 0; // no point to call us if we are done
 }
 
 // tells the host that we are not interested in [more] vb
 // if the host does not know that already
 void Adapter::Xaction::stopVb() {
        if (receivingVb == opOn) {
-               hostx->vbStopMaking();
+               hostx->vbStopMaking(); // we will not call vbContent() any more
                receivingVb = opComplete;
        } else {
                // we already got the entire body or refused it earlier
                Must(receivingVb != opUndecided);
        }
 }
 
 // this method is used to make the last call to hostx transaction
 // last call may delete adapter transaction if the host no longer needs it
 // TODO: replace with hostx-independent "done" method
Index: src/adapter_passthru.cc
===================================================================
--- src/adapter_passthru.cc     (revision 12840)
+++ src/adapter_passthru.cc     (working copy)
@@ -207,20 +207,21 @@
 void Adapter::Xaction::abContentShift(size_type size)
 {
        Must(sendingAb == opOn);
        hostx->vbContentShift(size);
 }
 
 
 void Adapter::Xaction::noteVbContentDone(bool atEnd)
 {
        Must(receivingVb == opOn);
+       hostx->vbStopMaking(); // we will not call vbContent() any more
        receivingVb = opComplete;
        hostx->noteAbContentDone(atEnd);
 }
 
 void Adapter::Xaction::noteVbContentAvailable()
 {
        Must(receivingVb == opOn);
        if (sendingAb == opOn)
                hostx->noteAbContentAvailable();
 }




--
View this message in context: 
http://squid-web-proxy-cache.1019090.n4.nabble.com/memory-leak-associated-w-running-any-ecap-adapter-tp4657812p4665986.html
Sent from the Squid - Development mailing list archive at Nabble.com.

Reply via email to