Executing CAknDialog derived classes caused used memory not released after dialog destruction.

// From symbian tips for CleanupStack
{for (TInt ii=0;ii<1000;++ii)
CleanupStack::PushL(&ii);}
CleanupStack::Pop(1000);

// mark heap
__UHEAP_MARK;

TMemoryInfoV1Buf info;
UserHal::MemoryInfo(info);
TInt freeMemory = info().iFreeRamInBytes; // start

CAknDialog* theDlg = new(ELeave)CAknDialog();
theDlg->ExecuteLD(R_DIALOG);
__UHEAP_MARKEND; // Memory leak reported from here

UserHal::MemoryInfo(info);
freeMemory = info().iFreeRamInBytes;// end

Trace of memory if not using UHEAP macro.
First run free memory 6213632 (start)
First run free memory 6135808 (end)

Second run free memory 6131712 (start)
Second run free memory 6119424(end)

Third run free memory 6119424 (start) = 6119424 (end).

After application closed, there is no memory leaks, so AVKON or something release heap memory. If dialog is big, for example Settings dialog with several tabs, memory wasting very fast.

RESOURCE DIALOG r_dialog
{

flags=EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EikDialogFlagFillAppClientRect |
EEikDialogFlagCbaButtons | EEikDialogFlagWait;//EEikDialogFlagModeless;

buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
}

Is there any way to free used memory, not closing program?

Thanks