help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory leaks when interacting with ROOT.


From: Elias Salomão Helou Neto
Subject: Memory leaks when interacting with ROOT.
Date: Thu, 22 Jul 2010 03:38:28 -0300

Hello, this is my first post.

I am trying to interface Octave with ROOT to be able to read some large files 
in their format. I am, however, experiencing memory leaks when loading .oct 
files linked against the ROOT library. While it is obviously related to ROOT, I 
believe it is because of some flag I should set when using mkoctfile, that's 
why i am posting this message here.

Consider the following piece of code:

//File memtest.cc
#include <octave/oct.h>
#include <root/TFile.h>

DEFUN_DLD( memtest, args, , "Tests for memory leak." )
{
   return( octave_value() );
}


If I compile it using:

mkoctfile $(root-config --libs --noauxlibs | sed s/-pthread// | sed 
s/-rdynamic//) -o memtest.oct memtest.cc

and repeatedly run 

memtest; clear all;

from octave's prompt, I can go from the starting 9MB footprint to several 
hundreds of megabytes and more.

The command inside $() expands to

-L/usr/lib/root -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree 
-lRint -lPostscript -lMatrix -lPhysics -lz  -lm -ldl

As I understand, the -rdynamic is default for mkoctfile. Could the remotion of 
"-pthreads" be the cause of the problem, or is there any other tweak in the 
compilation flags to fix the leak? How should I pass -pthreads to mkoctfile?

I honestly do not believe that such obvious issue to be a bug in Octave or 
ROOT, but rather that it is a compilation issue.

I will appreciate any advice.

Elias.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]