Project

Profile

Help

Revision 146cfacb

Added by O'Neil Delpratt 5 months ago

Saxon/C memory management patches

View differences:

src/main/c/Saxon.C.API/XdmItem.cpp
36 36
}
37 37

  
38 38

  
39

  
40

  
41
   XdmItem * XdmItem::getHead(){ return this;}
39
XdmItem * XdmItem::getHead(){ return this;}
42 40

  
43 41
  XdmItem * XdmItem::itemAt(int n){
44 42
	if (n < 0 || n >= size()) {
......
95 93
	}
96 94

  
97 95
XdmItem::~XdmItem() {
98
    decrementRefCount();
96
    //decrementRefCount();
99 97
    std::cerr<<std::endl<<"XdmItem destructor called, refCount"<<getRefCount()<<std::endl;
100
    std::cout << std::endl << "cpp0-1" << std::endl;
98

  
101 99
    SaxonProcessor::sxn_environ->env->ExceptionDescribe();
102 100

  
103
    if(getRefCount()<1){
104
        if(value !=nullptr && SaxonProcessor::jvmCreatedCPP>0) {
105
            SaxonProcessor::sxn_environ->env->DeleteGlobalRef(value);
106
        }
107
        std::cout << std::endl << "cpp0-1" << std::endl;
108
        SaxonProcessor::sxn_environ->env->ExceptionDescribe();
109
        if(stringValue.empty()) {
110
            stringValue.clear();
111
        }
101
    if(value !=nullptr && SaxonProcessor::jvmCreatedCPP>0) {
102
        std::cout << std::endl << "cpp0-1: DeleteGlobalRef" << std::endl;
103
        SaxonProcessor::sxn_environ->env->DeleteGlobalRef(value);
104
    }
105
    std::cout << std::endl << "cpp0-1" << std::endl;
106
    SaxonProcessor::sxn_environ->env->ExceptionDescribe();
107
    if(stringValue.empty()) {
108
        stringValue.clear();
112 109
    }
113 110
}
114 111

  

Also available in: Unified diff