Commit c362ab1b authored by Adam Reichold's avatar Adam Reichold Committed by Albert Astals Cid

Remove DEBUG_MEM from Object since this uses RAII now and hence cannot leak....

Remove DEBUG_MEM from Object since this uses RAII now and hence cannot leak. (The existing tracking also is not thread-safe and hence unreliable.)
parent 122b3ca5
......@@ -58,11 +58,6 @@ static const char *objTypeNames[numObjTypes] = {
"dead"
};
#ifdef DEBUG_MEM
int Object::numAlloc[numObjTypes] =
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#endif
Object::Object(Object&& other)
{
type = other.type;
......@@ -112,9 +107,6 @@ Object Object::copy() const {
default:
break;
}
#ifdef DEBUG_MEM
++numAlloc[type];
#endif
return obj;
}
......@@ -154,9 +146,6 @@ void Object::free() {
default:
break;
}
#ifdef DEBUG_MEM
--numAlloc[type];
#endif
type = objNone;
}
......@@ -234,23 +223,3 @@ void Object::print(FILE *f) const {
break;
}
}
void Object::memCheck(FILE *f) {
#ifdef DEBUG_MEM
int i;
int t;
t = 0;
for (i = 0; i < numObjTypes; ++i)
t += numAlloc[i];
if (t > 0) {
fprintf(f, "Allocated objects:\n");
for (i = 0; i < numObjTypes; ++i) {
if (numAlloc[i] > 0)
fprintf(f, " %-20s: %6d\n", objTypeNames[i], numAlloc[i]);
}
}
#else
(void)f;
#endif
}
......@@ -132,17 +132,8 @@ enum ObjType {
// Object
//------------------------------------------------------------------------
#ifdef DEBUG_MEM
#define initObj(t) free(); zeroUnion(); ++numAlloc[type = t]
#else
#define initObj(t) free(); zeroUnion(); type = t
#endif
#ifdef DEBUG_MEM
#define constructObj(t) ++numAlloc[type = t]
#else
#define constructObj(t) type = t
#endif
class Object {
public:
......@@ -291,9 +282,6 @@ public:
const char *getTypeName() const;
void print(FILE *f = stdout) const;
// Memory testing.
static void memCheck(FILE *f);
private:
friend class Array; // Needs free and initNullAfterMalloc
friend class Dict; // Needs free and initNullAfterMalloc
......@@ -318,11 +306,6 @@ private:
Stream *stream; // stream
Ref ref; // indirect reference
};
#ifdef DEBUG_MEM
static int // number of each type of object
numAlloc[numObjTypes]; // currently allocated
#endif
};
//------------------------------------------------------------------------
......
......@@ -121,8 +121,7 @@
// Also, there are preprocessor symbols in the header files
// that are used but never defined when building poppler using configure
// or cmake: DISABLE_OUTLINE, DEBUG_MEM,
// ENABLE_PLUGINS, DEBUG_FORMS
// or cmake: DISABLE_OUTLINE, ENABLE_PLUGINS, DEBUG_FORMS
//------------------------------------------------------------------------
// version
......
......@@ -314,8 +314,5 @@ int main(int argc, char *argv[]) {
delete globalParams;
err0:
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......@@ -223,9 +223,6 @@ int main(int argc, char *argv[]) {
delete globalParams;
err0:
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......
......@@ -229,8 +229,5 @@ int main(int argc, char *argv[]) {
delete globalParams;
err0:
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......@@ -752,8 +752,5 @@ int main(int argc, char *argv[]) {
delete globalParams;
err0:
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......@@ -1284,8 +1284,5 @@ int main(int argc, char *argv[]) {
gfree(icc_data);
#endif
// check for memory leaks
Object::memCheck(stderr);
return 0;
}
......@@ -451,9 +451,6 @@ int main(int argc, char *argv[]) {
if(htmlFileName) delete htmlFileName;
HtmlFont::clear();
// check for memory leaks
Object::memCheck(stderr);
return exit_status;
}
......
......@@ -651,8 +651,5 @@ int main(int argc, char *argv[]) {
delete globalParams;
err0:
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......@@ -442,8 +442,5 @@ int main(int argc, char *argv[]) {
err0:
delete globalParams;
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......@@ -431,9 +431,6 @@ int main(int argc, char *argv[]) {
delete globalParams;
err0:
// check for memory leaks
Object::memCheck(stderr);
return exitCode;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment