Memory leaks in SmartCheck



What kind of memory leaks will SmartCheck report?


You will only see memory leaks for blocks of memory that were allocated and never freed. Any memory consumed by objects that are managed by the VB runtime is freed upon program termination and therefore does not qualify as a "Memory Leak".

Any program that uses dynamic allocation of memory is prone to leave some memory allocated when the program finishes.

Example code for a memory leak that SmartCheck will detect.

Sub MemoryLeak()

'Allocates space for 1000 integers, but forgets to free it

Dim lGMem As Long

lGMem = GlobalAlloc(GMEM_FIXED, 4000)

'Take some action on the memory

End Sub

Old KB# 11830
Comment List
Related Discussions