#Resources Low
11-Jul-94 11:22:05
Sb: #30275-#Resources Low
Fm: Brian Maughan 72302,3156
To: Glenn Rogers 73173,443
Glenn,
I've been down your road and know how frustrating a resource leak can be.
During my journey this forum's sysop (Don Schmitt) recommended several
articles:
ID: Q71455
INF:Tracking Down Loast System Resources
ID: Q66654
TITLE: INF: Possible Causes for System Resource Reduction
ID: Q72236
TITLE: INF: Maximizing the Use of Available Memory in Windows
Basically, I've found that MFVC does a pretty decent job of cleaning up after
itself, as far as dynamically allocated resources go. However, there are some
pitfalls to look out for:
1. Make sure to attach, using AddDocTemplate(), all document Template's that
you create — otherwise I believe that the resources associated with the
Template instance are not freed.
2. If you are using CFormView as a child window of a CFrameWnd (or derivative)
make sure that you do NOT associate a default menu with the form in App Studio
— otherwise MSVC will allocate the forms default menu in addition to the menu
associated with the frame (the CFormView's parent), but will not clean up the
resource allocation when you DestroyWindow() the frame.
Other than this, there are a variety of ways that one can loose resource heap
if you are allocating resources manually (basically by forgetting to free the
resource). However, if you're letting the frame do all of your resource
allocations, I would suggest you check out the above two possibilities.
Regards,
Brian