Hi, As I see now, the best way for test purposing is to have two methods one with destructor as it is now and a second one with the delete operator. In this case it will be possible at 'prg' level to test/design the final destructor for both prg class and Qt native class.
Best regards, István -----Original Message----- From: harbour-boun...@harbour-project.org [mailto:harbour-boun...@harbour-project.org] On Behalf Of Pritpal Bedi Sent: 2009. szeptember 16. 23:16 To: harbour@harbour-project.org Subject: RE: [Harbour] demoqt tests with debug_new - Leaked objects Hi Bisz István wrote: > > I executed the following test cases with debug_new: > > Case 1: > > // With this cpp function > // See: leakobj_with_delete.txt > HB_FUNC( QT_QRECT_DESTROY ) > { > //hbqt_par_QRect( 1 )->~QRect(); > delete hbqt_par_QRect( 1 ); > } > > Case 2: > > > // With this cpp function > // See: leakobj_without_delete.txt > HB_FUNC( QT_QRECT_DESTROY ) > { > hbqt_par_QRect( 1 )->~QRect(); > //delete hbqt_par_QRect( 1 ); > } > > Case 3: > > // With this cpp function > // See: leakobj_with_destructor_and_delete.txt > HB_FUNC( QT_QRECT_DESTROY ) > { > hbqt_par_QRect( 1 )->~QRect(); > delete hbqt_par_QRect( 1 ); > } > > The resulted log files are attached. > > The reserved heap size at the end goes to zero just in test case 1 and 3. > 'delete: freed 0x80b5a60 (size 4, 0 bytes still allocated)'. > Test case 2 shows that QRect (with size 16 bytes) allocated by Qt remains > on > the heap. 'delete: freed 0x8e8aa60 (size 4, 16 bytes still allocated). > > Pritpal, could you please insert the delete operator in the destructors > logic? An another solution is to define a new Delete() method containing > just the delete operator. > In any case this second solution will help the further investigations. > I have already implemented case 1. But still experimenting. It is not the case that the memory is release properly at the "END" of the application, I need to have it released as soon as an object is "destroyed". Hopefully we may find a solution with further investigations. Keep on your good work of debugging and tips. BTW which is the best case? 1 or 3 ? Regards Pritpal Bedi -- View this message in context: http://www.nabble.com/demoqt-tests-with-debug_new---Leaked-objects-tp25434990p25480816.html Sent from the Harbour - Dev mailing list archive at Nabble.com. _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour