Running without the drop at the end of the test indicates root cause is a memory leak
130812 19:23:46 [Note] /home/andrew/develop/maria/repo/oqgraph-varchar/build/sql/mysqld: ready for connections. Version: '10.0.1-MariaDB-debug-log' socket: '/home/andrew/develop/maria/repo/oqgraph-varchar/build/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution Warning: 984 bytes lost, allocated by T@2 at mysys/my_alloc.c:233, sql/thr_malloc.cc:77, sql/field.h:163, sql/field.cc:9501, sql/table.cc:1590, sql/table.cc:747, ??:0, sql/handler.cc:2347 Warning: 1744 bytes lost, allocated by T@2 at mysys/my_alloc.c:233, sql/sql_list.h:43, myisam/ha_myisam.cc:128, sql/handler.cc:252, sql/table.cc:1370, sql/table.cc:747, ??:0, sql/handler.cc:2347 Warning: 984 bytes lost, allocated by T@2 at mysys/my_alloc.c:233, ??:0, sql/handler.cc:2347, sql/table.cc:2663, sql/sql_base.cc:3207, sql/sql_base.cc:4564, sql/sql_base.cc:5115, sql/sql_base.cc:5718 Memory lost: 3712 bytes in 2204 chunks mysqld: /home/andrew/develop/maria/repo/oqgraph-varchar/sql/sql_class.cc:1572: virtual THD::~THD(): Assertion `status_var.memory_used == 0' failed.
I did some funky stuff in gdb and worked out that the oqgraph3::cursor has a reference count that never falls to zero:
andrew@atlantis3:~/develop/maria$ egrep '_ref_count|#2' refs1.txt | paste - -|grep cursor 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22c3f10, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22c4130, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22d6de0, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22d6eb0, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22d7670, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22d7740, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3::cursor::~cursor (this=0x22d6eb0, __in_chrg=<optimized out>) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:93 168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3::cursor::~cursor (this=0x22d6de0, __in_chrg=<optimized out>) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:93 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22d7020, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3::cursor::cursor (this=0x22d6d80, graph=...) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:69 168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3::cursor::~cursor (this=0x22d7020, __in_chrg=<optimized out>) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:93 168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3::cursor::~cursor (this=0x22d7670, __in_chrg=<optimized out>) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:93 168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3::cursor::~cursor (this=0x22d7740, __in_chrg=<optimized out>) at /home/andrew/develop/maria/repo/oqgraph-varchar/storage/oqgraph/oqgraph_thunk.cc:93
This was also visible in the debugger at the assertion point - _ref_count=3
Running without the drop at the end of the test indicates root cause is a memory leak
130812 19:23:46 [Note] /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ build/sql/ mysqld: ready for connections. MariaDB- debug-log' socket: '/home/ andrew/ develop/ maria/repo/ oqgraph- varchar/ build/mysql- test/var/ tmp/mysqld. 1.sock' port: 16000 Source distribution alloc.c: 233, sql/thr_ malloc. cc:77, sql/field.h:163, sql/field.cc:9501, sql/table.cc:1590, sql/table.cc:747, ??:0, sql/handler.cc:2347 alloc.c: 233, sql/sql_list.h:43, myisam/ ha_myisam. cc:128, sql/handler.cc:252, sql/table.cc:1370, sql/table.cc:747, ??:0, sql/handler.cc:2347 alloc.c: 233, ??:0, sql/handler. cc:2347, sql/table.cc:2663, sql/sql_ base.cc: 3207, sql/sql_ base.cc: 4564, sql/sql_ base.cc: 5115, sql/sql_ base.cc: 5718 develop/ maria/repo/ oqgraph- varchar/ sql/sql_ class.cc: 1572: virtual THD::~THD(): Assertion `status_ var.memory_ used == 0' failed.
Version: '10.0.1-
Warning: 984 bytes lost, allocated by T@2 at mysys/my_
Warning: 1744 bytes lost, allocated by T@2 at mysys/my_
Warning: 984 bytes lost, allocated by T@2 at mysys/my_
Memory lost: 3712 bytes in 2204 chunks
mysqld: /home/andrew/
I did some funky stuff in gdb and worked out that the oqgraph3::cursor has a reference count that never falls to zero:
andrew@ atlantis3: ~/develop/ maria$ egrep '_ref_count|#2' refs1.txt | paste - -|grep cursor :cursor: :cursor (this=0x22c3f10, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :cursor (this=0x22c4130, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :cursor (this=0x22d6de0, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :cursor (this=0x22d6eb0, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :cursor (this=0x22d7670, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :cursor (this=0x22d7740, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :~cursor (this=0x22d6eb0, __in_chrg= <optimized out>) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 93 :cursor: :~cursor (this=0x22d6de0, __in_chrg= <optimized out>) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 93 :cursor: :cursor (this=0x22d7020, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :cursor (this=0x22d6d80, graph=...) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 69 :cursor: :~cursor (this=0x22d7020, __in_chrg= <optimized out>) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 93 :cursor: :~cursor (this=0x22d7670, __in_chrg= <optimized out>) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 93 :cursor: :~cursor (this=0x22d7740, __in_chrg= <optimized out>) at /home/andrew/ develop/ maria/repo/ oqgraph- varchar/ storage/ oqgraph/ oqgraph_ thunk.cc: 93
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3:
168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
163 ptr->_ref_count++; #2 0x00000000009a5e9c in oqgraph3:
168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3:
168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3:
168 ptr->_ref_count--; #2 0x00000000009a659f in oqgraph3:
This was also visible in the debugger at the assertion point - _ref_count=3