GlobalAlloc vs new + PurifyNT
Posted on 1998-05-22
VC++5, NT4 SP1, MsCOMM32.ocx, DAO35
If I wanted a circular buffer allocated in one function to be accessable to other functions, can I use "new" to allocate the memory???
The reason I asked this is because I have tried a runtime error checking program PurifyNT on my app & it reported uninitialize memory access on the circular buffer. I am able to run my app well but after collecting about 2000 records from the COM ports, I suddenly encountered this weird thing : my app closes down without even Dr Watson or any error messages ??? What's happening ??? The only thing I noticed is that the program starts "sucking up" memory tremedously just before it closes ???
My app is a DAO35 MFC AppWizard Generated Program using VC++5 in WinNT4 SP1. The objective is to capture all inputs from COM ports into an Access97 database.
Noticing this "smooth" termination, I ran PurifyNT & noticed this uninitialized warnings. In your expert opinion, must I replace those "new" operator to GlobalAlloc() & GlobalLock() if I wanted the circular buffer to be safely allocated & recognized.
Hope anyone can help, it's very urgent :(
Thanks alot for any info :)
PS. PurifyNT also warns many standard DLLs (Kernel32, OleAut32, OleVar, etc) Memory Leak or uninitalize warnings on the standard lib functions (eg, CDaoRecordSet:Open(), GetFieldValue(), SetFieldValue(), etc), Do I have to bother about them ??? I have never altered their codes. Do I need any patches ??