Hi Kish, On Donnerstag, 29. Januar 2009, you wrote: > Since you have multiple versions of ECLiPSe, you must ensure that the > correct version of libeclipse.so is loaded when you run your program. > In Unix, the system will search the directories defined in > LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH on Mac OS X), so if you change the > version of ECLiPSe you are using, you need to modify LD_LIBRARY_PATH (as > well as ECLIPSE_DIR, which you are using to point to the ECLiPSe > directory). Of course you are right, I forgot to set the LD_LIBRARY_PATH. Sorry about the confusion. Now the example works with all eclipse versions. Although it is better with version 6.0_58, the original problem still persists. Memory for references isn't freed completely. I had to change the example program slightly to show the effect, but still for each call of function f additional 40kB of memory are used, which makes about 40 bytes per created reference. Regards, Stephan // ==================================== // example program #include "eclipse.h" #include "stdlib.h" #include "stdio.h" #include "unistd.h" void g(){ ec_ref ref=ec_ref_create_newvar(); ec_post_goal(ec_term(ec_did("p",1),ec_ref_get(ref))); ec_resume(); ec_ref_destroy(ref); } void f(){ int i; for(i=0;i<1000;++i){ g(); } ec_post_goal(ec_term(ec_did("garbage_collect",0))); ec_resume(); } int main(){ int i; printf("ec_init\n"); ec_set_option_ptr(EC_OPTION_ECLIPSEDIR, getenv("ECLIPSE_DIR")); ec_init(); ec_post_string("compile_term([p(a)])"); ec_resume(); for(i=0;i<10;++i){ printf("iteration %d\n",i); f(); sleep(1); } ec_cleanup(); return 0; } // ====================================Received on Fri Jan 30 2009 - 09:15:56 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST