I just came across little memory handling problem --
Reconciliator rec(&recon_scenario, new TradeRecordParser(new XXXTradeList), new TradeRecordParser(new YYYTradeList));
Assuming all the classes are conforming to the standards, and object instances are well behaved. The above technique will require some mechanism to delete objects allocated on a hip whilst for Reconciliator there is no indication on how they were allocated. To solve the problem I introduced globally (somewhere at the beginning of main) one integer on a stack and one pointer to integer on the hip, so pointers to instances of the hipped objects will have value greater then pointer to global int* that was hipped, and those of stacked ones less then &int of stacked one.
Finally, the question is -- will that be portable across platforms/compilers/whatever? Any comments are welcome.
Thanks.



Reply With Quote
