Commit 909d1d56024ce10dbb56b313fd0d402894c18049

Authored by Jay Berkenbilt
1 parent 7559934b

another bug description


git-svn-id: svn+q:///qpdf/trunk@974 71b93d88-0707-0410-a8cf-f5a4172ac649
Showing 1 changed file with 44 additions and 0 deletions
  1 +Bug
  2 +===
  3 +
  4 + * There is a memory leak that happens whenever object A refers to
  5 + object B which refers back to object A. We have the following
  6 + pattern:
  7 +
  8 + #include "PointerHolder.hh"
  9 +
  10 + class A
  11 + {
  12 + public:
  13 + PointerHolder<A> a;
  14 + };
  15 +
  16 + int main()
  17 + {
  18 + A a1;
  19 + a1.a = new A();
  20 + a1.a.getPointer()->a = new A();
  21 + a1.a.getPointer()->a.getPointer()->a = a1.a;
  22 + return 0;
  23 + }
  24 +
  25 + In order to fix this, we have to explicitly break circular
  26 + references, but we have to do this at a time that doesn't
  27 + completely destroy performance.
  28 +
  29 + To debug, configure with
  30 +
  31 + ./configure --disable-shared --disable-test-compare-images \
  32 + CFLAGS=-g CXXFLAGS=-g
  33 +
  34 + Current code causes test failures. linearize segfaults on
  35 + hybrid-xref.pdf, and the test suite fails in various places. Maybe
  36 + because we don't do any kind of loop detection?
  37 +
  38 + Use valgrind --leak-check=full to see leak details.
  39 +
  40 + The file memory-leak.pdf is a minimal case that shows the problem.
  41 +
  42 + Files in trace having tracing to show which objects haven't been
  43 + allocated.
  44 +
1 45 Next
2 46 ====
3 47  
... ...