Hi Hans,
First, you own the molecule returned by the supplier, and you are responsible
in deleting it in time. Second, your code actually deletes the molecule after
done using it, but you also create a molecule that does not get deleted
properly. Try the following:
#include <GraphMol/FileParsers/MolSupplier.h>
int
main(int argc, char *argv[])
{
RDKit::SmilesMolSupplier
supplier("/Users/hans/Silicos-it/Databases/eMolecules/02-eMolecules-2011-01-02.smi",
" \t", 0, 1, false, true);
RDKit::ROMol* mol;
while (!supplier.atEnd())
{
// mol = new RDKit::ROMol;
mol = supplier.next();
if (mol)
{
std::cout << mol->getNumAtoms() << std::endl;
delete mol;
}
// delete mol;
mol = NULL;
}
}
Regards,
Eddie
On Jul 20, 2011, at 11:58 AM, Hans De Winter wrote:
> Hi,
>
> I've succesfully managed to compile/link/run the following code (Thx to Greg
> and Eddie):
>
> ---
> #include <GraphMol/FileParsers/MolSupplier.h>
>
> int
> main(int argc, char *argv[])
> {
> RDKit::SmilesMolSupplier
> supplier("/Users/hans/Silicos-it/Databases/eMolecules/02-eMolecules-2011-01-02.smi",
> " \t", 0, 1, false, true);
> RDKit::ROMol* mol;
>
> while (!supplier.atEnd())
> {
> mol = new RDKit::ROMol;
> mol = supplier.next();
> if (mol)
> {
> std::cout << mol->getNumAtoms() << std::endl;
> }
> delete mol;
> mol = NULL;
> }
> }
> ---
>
> When I run this on a input file of +3M molecules (the
> '02-eMolecules-2011-01-02.smi' file in the example above), I notice that my
> free memory is going down slowly, looking like a memory error... Any clues
> what I am doing wrong? Could it be that the SmilesMolSupplier does not clear
> internal memory after passing the data through the assignment to the mol
> instance?
>
> Regards,
> Hans
>
> PS. Compiled and running on OS X 10.6.8
>
>
>
>
>
>
> <Logo SilicosIT Email2.jpg>
>
>
> Silicos-IT is a division of Imacosi bvba
> De Roskam 35
> 2970 Schilde
> Belgium
>
>
>
>
>
------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss