Strange errors when linking to libmariadb

426 views Asked by At

I'm currently develop an Objective-C library that links to the MariaDB C connector. I believe there is a problem with the library, though.

Every time I execute my code I get very strange errors on the console. The -(id)init method of my library calls mysql_init(NULL) to initialise the library but as soon as I return from -(id)init I get the following errors in the console:

Object 0x10643df70 of class XXX autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug

Thing is, there is no multithreaded code being executed and if I run the same - (id)init without the call to mysql_init(NULL) the errors disappear. I believe the libmariadb library is causing these errors to appear. I don't get why though.

Do I need to build it with any special command line switches? Am I calling the right methods? I obviously used the MySQL online documentation as a guide.

3

There are 3 answers

0
ruipacheco On BEST ANSWER

I was busy with other stuff for a while. I've since updated MariaDB to the latest version and, as far as I can tell, it works fine.

1
pfrank On

Make sure you add this anytime you have a new thread:

@autoreleasepool {

//enter code here
}
0
Georg Richter On

Have you tried latest revision from launchpad? Also try to build libmariadb with -DUNDEF_THREADS_HACK and CMAKE_USE_PTHREADS:BOOL=OFF)