I'm creating a stream object stored in global memory.

GetImage() function

IStream *pStream;
::CreateStreamOnHGlobal(NULL,TRUE,&pStream);
image->Save(pStream,&encoderClsid,&encoderParameters);
..// bit operations no memory allocations just math calcuations
//then
delete image;
pStream->Release();

the problem i have when application is run ,and begin executing the GetImage
Function, the memory is keep increase after each call and nothing is freed,
what should i do to free memory after each call the two statements :

delete image;
pStream->Release(); as they have to effects

I also tried to use GlobalFree(pStream), and GlobalFree(&pStream) with no
avail. memory keep rasing after each call