[GiNaC-list] memory leak when constructing expression from a string

Alexei Sheplyakov varg at theor.jinr.ru
Fri Nov 16 12:40:29 CET 2007


Hello!

This silly program

#include <iostream>
#include <stdexcept>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main(int argc, char** argv) {
	ex e;
	const symbol x("x"), y("y");
	const lst syms(x, y);
	static const char* str[] = { "x^2+2*x*y + cos(x)", "Li2(x/y) + log(y/x)" };
	unsigned N=0;
	try {
		for (; ; N++) {
			e = ex(str[N & 1], syms);
		}
	} catch (...) {
		cerr << "N = " << N << endl;
		return 1;
	}
	return 0;
}

exhausts all the available memory. I don't think this is correct
behaviour. Any suggestions how to fix this?

Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20071116/44f4b1c6/attachment.pgp


More information about the GiNaC-list mailing list