Closed Bug 10937 Opened 25 years ago Closed 25 years ago

UMR: MLK: Component Registration problems (Purify)

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: bruce, Assigned: dp)

References

()

Details

Major problems in Component Registration.

This is new since 2 days ago for sure. Possibly new since sometime yesterday.  I
built on Solaris 2.6, gcc 2.7.2.3, with Purify.  Fairly default type of build.
Ran 'viewer.pure about:blank' and got this output (minus a bunch of FMM junk):
http://www.cybersight.com/~bruce/viewer.about.blank.19990730.log

With this fixed, we'd be looking at under 10k of leaks for viewer in loading
about:blank again (first time in some months).
Status: NEW → ASSIGNED
Target Milestone: M9
Seth some of these are in filespec. I hope you will deal with those.
According to bruce, the realpath function on Solaris bites as it does not null
terminate the buffer.  He suggested that we add a function that would wrap
realpath that would do this initialization of buffers.

Here is the code.  I basically moved the solaris clearing into a function and
made all calls to realpath refer to it.  Hopefully with this patch, most of the
errors in the attachement will go away.


RCS file: /cvsroot/mozilla/xpcom/io/nsFileSpecUnix.cpp,v
retrieving revision 1.43
diff -r1.43 nsFileSpecUnix.cpp
74a75,91
>
> //----------------------------------------------------------------------------
> // Utility functions
> //----------------------------------------------------------------------------
>
> char*
> nsRealPath(char*path, char *resolvedPath)
> {
> #if defined(SOLARIS)
>     memset(resolvedPath, '\0', sizeof(resolvedPath)); // realpath reads it all
, initialized or not.
> #else
>     *resolvedPath = '\0';
> #endif
>     return realpath(path, resolvedPath);
> }
>
>
89,94c106,107
< #if defined(SOLARIS)
<     memset(buffer, '\0', sizeof(buffer)); // realpath reads it all, initialize
d or not.
< #else
<     *buffer = '\0';
< #endif
<     char* canonicalPath = realpath((const char*)ioPath, buffer);
---
>
>     char* canonicalPath = nsRealPath((const char*)ioPath, buffer);
107c120
<             canonicalPath = realpath((const char*)allButLeaf, buffer);
---
>             canonicalPath = nsRealPath((const char*)allButLeaf, buffer);
116c129
<         canonicalPath = realpath(".", buffer);
---
>         canonicalPath = nsRealPath(".", buffer);
238c251
<       char* canonicalPath = realpath((const char *)mPath, resolvedPath);
---
>       char* canonicalPath = nsRealPath((const char *)mPath, resolvedPath);
I wouldn't ifdef that for solaris.  other platforms may have the problem too.

and it can't hurt to be careful.

we don't do it often enough for performance to matter, so I say check it in with
out the #ifdef SOLARIS
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Component Manager related leaks should be solved. Knowing bruce, I think there
will be bugs on other components for the rest.

So marking this fixed. Bruce might be the best person to verify this bug.
Component: XPCOM Registry → XPCOM
QA Contact: dp → xpcom
You need to log in before you can comment on or make changes to this bug.