File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 18
18
19
19
#include " nsIServiceManager.h"
20
20
21
- // Gee this seems simple! It's for testing for memory leaks.
21
+ // Gee this seems simple! It's for testing for memory leaks with Purify .
22
22
23
- void main ()
23
+ void main (int argc, char * argv[] )
24
24
{
25
25
nsresult rv;
26
26
nsIServiceManager* servMgr;
27
27
rv = NS_InitXPCOM(&servMgr);
28
28
NS_ASSERTION (NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
29
+
30
+ // try loading a component and releasing it to see if it leaks
31
+ if (argc > 1 && argv[1 ] != nsnull) {
32
+ nsISupports* obj = nsnull;
33
+ rv = nsComponentManager::CreateInstance (argv[1 ], nsnull,
34
+ nsCOMTypeInfo<nsISupports>::GetIID (),
35
+ (void **)&obj);
36
+ if (NS_SUCCEEDED(rv)) {
37
+ printf (" Successfully created %s\n " , argv[1 ]);
38
+ NS_RELEASE (obj);
39
+ }
40
+ else {
41
+ printf (" Failed to create %s (%x)\n " , argv[1 ], rv);
42
+ }
43
+ }
44
+
29
45
rv = NS_ShutdownXPCOM(servMgr);
30
46
NS_ASSERTION (NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
31
47
NS_RELEASE (servMgr);
You can’t perform that action at this time.
0 commit comments