🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #322

Resource in iv 3.01

#322
From: William A. Hoffman
Date: Tue, 14 Apr 1992 23:27
43 lines
1484 bytes

	I am using the 2.6 compatibility mode in iv 3.01.  Several of my classes
inherit from Subject which inherits from Resource.  My program had a large
memory leak because of the following:


int Session::run() {
// stuff deleted
    do {
        read(e);
        e.handle();
    } while (!done);
}
 
void Event::handle() {
    Handler* h = grabber();
    if (h == nil) {
        h = handler();
    }
    if (h != nil) {
        boolean b = Resource::defer(true);   // this is the problem
        h->ref();
        h->event(*this);
        h->unref();
        Resource::flush();
        Resource::defer(b);
    }
}
 

All my code is going to be executed from the e.handle() call.  In effect this
means that Resource::defer is defaulted to true not false as it is stated in
the manual.   

	Is this a bug or a feature?  Should I wrap all my code that is called
from handle functions with:

	b = Resource::defer(false); my code;  Resource::defer(b);  



			-Bill Hoffman (hoffman@crd.ge.com)
Technical Details
Message-ID: <1992Apr14.232745.12859@crd.ge.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!crdgw1!rdsunx.crd.ge.com!albirio!hoffman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!crdgw1!rdsunx.crd.ge.com!albirio!hoffman
From: hoffman@albirio.NoSubdomain.NoDomain (William A. Hoffman)
Newsgroups: comp.windows.interviews
Subject: Resource in iv 3.01
Keywords: memory leak, subject, resource
Message-ID: <1992Apr14.232745.12859@crd.ge.com>
Date: 14 Apr 92 23:27:45 GMT
Sender: hoffman@albirio (William A. Hoffman)
Organization: GE Corporate R&D Center
Lines: 43
Nntp-Posting-Host: albirio.crd.ge.com