I'm trying to use CnMemProf wizard, but i have some difficulty to use them.
How to use them?i've tried create new project using CnMemProf wizard, but when i compile them, it need CnMemProf.Pas, but i couldn't find it anywhere. When i tried to save Unit1 from the wizard to CnMemProf it says project already has CnMemProf in it.
Please tell me how to create CnMemProf wizard?
Isn't it suppose to add CnMemProf on existing project to test the project memory usage??
I don't understand what, where and how to use them.
Thanks for your help
CnMemProf is in our cnpack component package. You need to install cnpack component package or just put the CnMemProf.pas in your search path.
You can download our latest cnpack component package from our website.Author:
iwancs Time: 2005-12-22 14:13
Thx, i've tried it, and it works.
Is it true that i should put the four line into the project source file of my existing project??
One other thing, can i have an english log file ?? thank youAuthor:
iwancs Time: 2005-12-22 14:39
sorry for the language question, i've try to trace the language problem, and i found that the language is defined in CnPack.inc. Maybe that's because i haven't installed the CnPack component yet.
Is there another way to changed the language ?
Can you tell me, how can i interprate the log, to trace where the problem exists?
Thanks for the help
Just copy the definitions of language items from CnConsts.pas to whereever you want.
And remove the {$I CnPack.inc}
That will work.
That's the way that extracting CnMemProf.pas from our CnPack compoent package.Author:
iwancs Time: 2005-12-22 22:13
Yes, done that, but can u help with the next question, how can i read the log file you've created, so that i can understand where the problem is.
ThanksAuthor:
shenloqi Time: 2005-12-23 10:48
I recommend you use fastmm4 (with fulldebugmode) to inspect memory leak.You can get it from http://fastmm.sourceforge.net .
Both FastMM and CnMemProf are used SetMemoryManager to inspect memory leak, and FastMM4 is more effective at memory manager.Author:
shenloqi Time: 2005-12-23 11:03 Subject: About the log
I Created a project as below to explain the log file.
First run the application, when the application exit, an messagebox report memory leak will show (if you check the option: show messagebox). If you open the log file, you can found where the memory leak is, but you can not know what is the memory leak object.
Open CnMemprof.pas, go to lin 71, modify this line to {$DEFINE LOGRTTI}, compile and run the application again, when you exit, you may recived some IDE exception report, ignore them. Then open the log file, you will see the log as below:
Application total run time: 0 hour(s) 0 minute(s) 0 second(s)。
There are 79 allocated before replace memory manager.
HeapStatus.TotalAddrSpace: 1024 KB
HeapStatus.TotalUncommitted: 1008 KB
HeapStatus.TotalCommitted: 16 KB
HeapStatus.TotalFree: 12 KB
HeapStatus.TotalAllocated: 3 KB
TotalAllocated div TotalAddrSpace: 0%
HeapStatus.FreeSmall: 5 KB
HeapStatus.FreeBig: 0 KB
HeapStatus.Unused: 6 KB
HeapStatus.Overhead: 0 KB
Objects count in memory: 15
1) 0000000000D91678 - 67($0043)Byte - Not an object
2) 0000000000D91E00 - 39($0027)Byte - Not an object
3) 0000000000D91F7C - 767($02FF)Byte - : TForm (760 Byte) - In Forms.pas
4) 0000000000D9228C - 42($002A)Byte - MS Sans Serif : TFont (36 Byte) - In Graphics.pas
5) 0000000000D912A8 - 39($0027)Byte - (no name): TSizeConstraints (32 Byte) - In Controls.pas
6) 0000000000D922B4 - 30($001E)Byte - (no name): TBrush (24 Byte) - In Graphics.pas
7) 0000000000D92318 - 79($004F)Byte - (no name): TControlScrollBar (72 Byte) - In Forms.pas
8) 0000000000D92364 - 78($004E)Byte - (no name): TControlScrollBar (72 Byte) - In Forms.pas
9) 0000000000D923B0 - 58($003A)Byte - (no name): TIcon (52 Byte) - In Graphics.pas
10) 0000000000D923E8 - 30($001E)Byte - Not an object
11) 0000000000D92404 - 106($006A)Byte - (no name): TControlCanvas (100 Byte) - In Controls.pas
12) 0000000000D9246C - 42($002A)Byte - MS Sans Serif : TFont (36 Byte) - In Graphics.pas
13) 0000000000D92494 - 34($0022)Byte - (no name): TPen (28 Byte) - In Graphics.pas
14) 0000000000D924B4 - 30($001E)Byte - (no name): TBrush (24 Byte) - In Graphics.pas
15) 0000000000D924D0 - 38($0026)Byte - Not an object
You will see a TForm object is not freed, the leak form's name is '', and it is 760 Byte.
3) 0000000000D91F7C - 767($02FF)Byte - : TForm (760 Byte) - In Forms.pas
You can also see other objects not freed, But they are owned by a TFrom object.
If you fixed the leak, you will recive the log as below:
:::::::::::::::::::::::::::::::::::::::::::::::::::::
2005-12-23 10:59:41
Application total run time: 0 hour(s) 0 minute(s) 0 second(s)。
There are 79 allocated before replace memory manager.
HeapStatus.TotalAddrSpace: 1024 KB
HeapStatus.TotalUncommitted: 1008 KB
HeapStatus.TotalCommitted: 16 KB
HeapStatus.TotalFree: 13 KB
HeapStatus.TotalAllocated: 1 KB
TotalAllocated div TotalAddrSpace: 0%
HeapStatus.FreeSmall: 0 KB
HeapStatus.FreeBig: 0 KB
HeapStatus.Unused: 13 KB
HeapStatus.Overhead: 0 KB
Objects count in memory: 0, No memory leak.
Sorry for my english.Author:
iwancs Time: 2005-12-23 13:06
Thx for the help, i've tried and it works, but i guess i'll try FastMM first, cause it still too hard to detect where the problem is.
In the log, it only define the unit name of the class, but not the unit name where the variable is defined.
Is there another way??
When i tried CnMemProf with my project, it says i have 22085 objects in list but i can't tell where the problem is
Thanks for the helpAuthor:
marykeens Time: 2009-11-4 19:20
Hope to see more replies one of these days,especially feedbacks from the thread starter. Seems like this thread has been inactive for such a long time. Think topic should be closed.