[myhdl-list] Re: MyHDL / ModelSim cosim
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2005-05-31 20:51:53
|
Jan Decaluwe wrote: > - freeing the callback handles explicitly doesn't work in Icarus > and makes no difference in cver. At this point I also don't > see why it should actually make a difference > - the malloc'ed memory is free'd automatically, so the > simulation crashes on an explicit attempt to free it. > > I'm searching for another explanation. I'v done some longer simulations, which confirm the above. However, the memory leak is very much worse in Icarus than in cver, even though the code is virtually identical. It is obvious in Icarus, and hard to notice in cver. I've looked further at the code, and I still don't see a problem. It is still possible that I didn't do anything wrong :-) (In that case, the problem would come from the PLI implementation of the simulator.) Perhaps the "standard" way of freeing a callback handle makes a difference for modelsim. As a said before, this doesn't work for Icarus, and it makes no difference for cver. But in the standard book on PLI, it is explicitly described as an important measure to avoid memory leaks. To do this, everywhere in the code where you have: vpi_register_cb(&cb_data_s); it should be replaced by: vpiHandle cb_h; // callback handle declaration ... cb_h = vpi_register_cb(&cb_data_s); vpi_free_object(cb_h); I have attached the code for cver as an example. It would be great if someone could check whether this makes a difference for modelsim (with respect to memory leakage). Jan -- Jan Decaluwe - Resources bvba - http://jandecaluwe.com Losbergenlaan 16, B-3010 Leuven, Belgium Using Python as a hardware description language: http://jandecaluwe.com/Tools/MyHDL/Overview.html |