Boost unit test not running with OF (memory leak?)

Getting started with unit testing using Boost, and I’m trying to use it with OF. I’ve tried to run a very simple (empty) unit test and it gives me a dump from RtAudio :confused:

RtAudio Version 4.0.12

Compiled APIs:
Windows ASIO
Windows Direct Sound

Current API: Windows Direct Sound

Found 4 device(s) …

Device Name = Default Device
Probe Status = Successful
Output Channels = 2
Input Channels = 2
Duplex Channels = 2


Input Channels = 2
Duplex Channels = 0
This is NOT the default output device.
This is NOT the default input device.
Natively supported data formats:
8-bit int
16-bit int
Supported sample rates = 11025 22050 44100 96000

Press any key to continue . . .

My guess is that Boost entry point for the tests is not defined and it happens to find some function over RtAudio. I have removed the ofApp.cpp and ofApp.h files and this is my main.cpp file:

#include "ofMain.h"
#include "ofLog.h"
#define BOOST_TEST_MODULE AvigilonVMSTest
#include "boost/test/unit_test.hpp"
using namespace std;


	ofLog() << "Something is wrong";


I have no idea on how to tackle this, I’m trying to find generic instructions on how to set the Boost entry point but I haven’t found anything.

I’m on VS2012, I’ve seen that removing the openFrameworksDebug/Release .props files resolves this issue (but it also gets rid of OF so it’s no solution).

Edit: I’m not using any sound, so I just completely removed sound and rtAudio libraries, which did solve the problem.

Edit 2: I get a weird memory leak reported if using OF at all, see the post below.

I have removed some libraries and files from OF that I wasn’t using. (Quicktime, rtaudio, sound module, cairo and videoInput). Now Boost unit tests run, but I get a memory leak error if I do not implement destructors in the header file.

This happens only if I am using OF at all. I’ll try to narrow it down to see what causes this… but I’m taking shots in the dark here.

when I see voodoo like this, I usually rebuild everything and check the build settings on all of the code and libraries and see if they are matching. you can get some funky bugs with .o files that are out of date and/or libs that have different build settings so there are ABI incompatibilities.

Yep the destructor thing was funky… I did rebuild :slight_smile: . Here’s what I found

It’s not a destructor implementation issue, but related to using OF. An empty test using an ofColor instance does give me the leak detection.

I’m trying to narrow it down a bit further. First of all I want to know whether this can be due to the libraries linked by OF… or OF itself. I am not certain on how Boost detects leaks, or whether these could be false positives.

It could be that Boost’s way to detect leaks is incompatible with OF. Is that possible? It seems boost uses the CRT for memory leak detection.

I’ve put up a VS2012 project with a Boost.props file (you need boost installed at BOOST_ROOT env variable). I’m actually using an empty OF project for this. It’s found at myApps/Boost_test.

every singleton (not many since the recent refactor to remove statics) in OF is created in the heap and never destroyed to avoid deinitialization order problems, so yes anything using OF will have a few theoretical mem leaks. in practice those are ok since the live of those variables must really be from the beginning till the end of the application.

Thanks for the info! Can you give me a singleton example in OF? I’ll see if I can isolate one to check if that actually causes the issue.

If so, are they by any chance listed somewhere?