Closed Bug 56584 Opened 25 years ago Closed 25 years ago

ns4xPlugin::CreatePlugin leaks ref to nsMemoryImpl

Categories

(Core Graveyard :: Plug-ins, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

VERIFIED FIXED
Future

People

(Reporter: dbaron, Assigned: serhunt)

References

Details

(Keywords: memory-leak, Whiteboard: [tind-mlk])

Attachments

(2 files)

The reference ns4xPlugin::CreatePlugin aquires to the global nsMemoryImpl through a GetService call seems to be leaked in every run of Mozilla. I'm not sure where it should be released or why it isn't. One possibility is that ns4xPlugin::CheckClassInitialized is setting mMalloc to null without releasing it. But that may or may not be it.
Whiteboard: [tind-mlk]
Not a Netscape 6 RTM blocker. FUTURE. This bug has been marked Future because the Netscape engineer it is assigned to is overburdened.
Target Milestone: --- → Future
The problem is that ns4xPlugin::Shutdown is never called, so mMalloc is never freed. But it really seems wrong to release a static variable every time Shutdown is called, although I'm not sure when it's supposed to be called.
The above patch fixes the leak, but I'm really not sure what the correct fix is. What's supposed to happen? Why is mMalloc set to null in CheckClassInitialized, and why is it currently released in Shutdown?
Keywords: 4xp
Blocks: 55959
Please look at the code after the fix for bug 58491 got in. It became global and not static, but some questions still remain, and I think we still should go with releasing it in the destructor.
I think it should be static so that there aren't name conflicts with other files. I don't see why either gServMgr or gMalloc was set to null in CheckClassInitialized, so I took those lines out rather than changing them the latter to a release. Why were they there?
The last patch looks ok to me. av, what do you think?
David, I don't know what the intention of the person who nulled gServMgr and gMalloc was, but I too don't see any reason for doing that. Your patch looks good and clean to me. r=av or a=av whatever you need to get it in.
Doesn't C++ default to static scope and lifetime (file scope) unless there is an extern on the definition as well as on any declarations? /be
I'm not sure, but I believe IRIX's compiler doesn't, which is a good reason to say |static| explicitly.
From reading C++ section 3.5 paragraphs 3-4, I think objects have internal linkage only when * explicitly declared |static|, or * when declared |const| and not |extern|
sr=waterson
Fix checked in 2000-12-08 20:06 PST.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
verified that the patch is in. (rubberstamp) VERIFIED.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: