[galib] How to delete a genome

Michele Conconi michele.conconi at unibo.it
Wed Apr 8 12:32:53 EDT 2009


Hi everybody.

I have a probably very stupid question. In my program I need to launch 
sequentially many GA, so I would like to delete my old genome and ga to 
free some memory. for example I use

...
GABin2DecGenome genome(map, Objective, (MyObject *) Object);
GASimpleGA ga(genome);
...

and I tried to delete them by writing

...
genome.~GABin2DecGenome();
ga.~GASimpleGA();
...

Anyway, my program always breaks down telling me

"Unhandled exception at 0x004040f5 in MyProgram.exe: 0xC0000005: Access 
violation reading location 0xdddddddd."

referring to this line (L 123) of gabin2decgenome.h:

 virtual ~GABin2DecGenome(){delete ptype;}

Also, I tried to use these expression

delete genome;
delete ga;

In many different form, but It does not allow me to compile my program.

What did I wrong? Thanks in advance

Michele
-- 
* Eng. Michele Conconi*
Ph.D. student
DIEM - Dept. of Mechanical Engineering
Alma Mater Studiorum - University of Bologna
Viale Risorgimento 2, 40136, Bologna, Italy
Email: michele.conconi at unibo.it
Website: http://www.diem.ing.unibo.it/grab
Office: (+39) 051 20 93451
Mobile: (+39) 329 0287996



* INFORMAZIONE RISERVATA E CONFIDENZIALE *
Questo messaggio contiene informazioni riservate e confidenziali.
Se il lettore non fosse il destinatario del messaggio, inoltrato e 
ricevuto per errore,
il testo dovrà essere immediatamente cancellato dal computer del ricevente.
E' assolutamente proibita qualunque circolazione, disseminazione o
copia del messaggio spedito e/o ricevuto per errore.

* CONFIDENTIALITY and WARNING NOTICE *
This message may contain legally privileged or confidential information.
If the reader is not the intended recipient, you received this message 
in error
and it should therefore be deleted from your computer at once.
Any dissemination, distribution and copying of a message
mistakenly sent or received is strictly forbidden.



More information about the galib mailing list