Closed Bug 22283 Opened 26 years ago Closed 25 years ago

memory leak of nsUnicodeEncodeHelper

Categories

(Core :: Internationalization, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: ftang, Assigned: yueheng.xu)

References

()

Details

(Keywords: memory-leak)

Attachments

(3 files)

We are leaking nsUnicodeEncodeHelpe in the Linux tinderbox leaking report. I think what happen is our coverter DLL hold nsUnicodeEncodeHelper (and probably also decode helper ) and never release it. We should hookup a Dll based shutdown rountine to free them.
Status: NEW → ASSIGNED
Ok, I'll look into it.
Target Milestone: M13
dp said jband will check in a new macro for the generic module which have a way to put in a shutdown routine. We can release the helper from the shutdown routine.
I checked this in last night. See NS_IMPL_NSGETMODULE_WITH_DTOR in nsIGenericFactory.h
Target Milestone: M13 → M14
Out of time for M13, moving to M14.
Change OS and Platform to ALL
OS: Linux → All
Hardware: PC → All
Keywords: beta1
We need to know how big the leak is on a per leak basis? How often does the leak occur. We need this for PDT to make right decision as to PDT+ or -. Thanks!
Agreed. In fact that is what cat and I discussed yesterday... From the latest Linux full log: http://cvs-mirror.mozilla.org/webtools/tindertest/showlog.cgi?log=SeaMonkey/9495 36186.29691.gz&fulltext=1 78 nsUnicodeEncodeHelpe 8 16 1602 2 (... So it looks like we leaked 2 x 8 bytes for a grand total of 16 bytes... So clearing beta1 keyword and moving to M15.
Keywords: beta1
Target Milestone: M14 → M15
I took a very brief look today at this bug and I don't see how we are leaking this helper, unless we leak a converter as well. We don't use it outside converters, where we realease it in destructors. Anyone has a more localized report? (Which file, a reproductible case, etc.) The link provided doesn't really work today... :(
Summary: memory leak of nsUnicodeEncodeHelpe → memory leak of nsUnicodeEncodeHelper
Oh, ok, I found it, I was searching for "nsUnicodeEncodeHelper" while the class name is truncated in reports to "nsUnicodeEncodeHelpe". Anyone knows what do I have to do to reproduce the bloat test and to get some more details? Thanks!
Aha! We are also leaking the nsBasicDecoderSupport class! That must be the reason for the helper class...
Please ingnore my last comment. We have no problem with the decoders. But we are leaking nsBasicEncoder. This is a base object which: a) implements NS_IMPL_ISUPPORTS which has our leak detection hooks b) is subclassed by detectors Practically, we can't leak it, because we never allocate it. My belive is that we are leaking converters - and seeing this. And this could be also paired with the helper object leaks: we are leaking the helpers because we are leaking their owners, the converters. So, the problem is not as simple as it seemed: we have to track conveter usage patterns and see *who* is leaking. (You know, xpcom, ref counting, yada, yada...) PS. The DLL keeps no reference to the helper, so there's nothing to release there! Only converters do that.
Target Milestone: M15 → M17
There are may be more than one source of converter leaks. Here I fix one of them. See the attached diff file: nsFontMetricsGTK.cpp.diff To look for more places, do a search on "->GetUnicodeEncoder". Whenever the smart COMPtr is not used, and also the NS_IF_RELEASE is not used, there is a possible leak in that section.
Assignee: cata → yueheng.xu
Status: ASSIGNED → NEW
Target Milestone: M17 → M16
the fix is for #22283, (not for #22218). Last diff file has a typo, the 'convert' should be 'converter'.
The last attachment shows a diff that can reduce the leak count (total of 2 ) of nsBasicEncoder and nsUnicodeEncoderHelp in the bloatview by one. The remaining leak count is a spurious resulted from that fact that the bloatview logged earlier than the destructor releases the class. I made this change in a way that we can easily comment out one line: aSelf->mConverter = 0; and uncomment two lines aSelf->mConverter = converter; NS_ADDREF(aSelf->mConverter); and we cab see the bloatview leak count will go up by one count. This change is attached here for review purpose. I don't see significant performance penalty before and after above change. At least for the default page. If for performance reason we need to let aSelf->Converter owns an instance of converter, we need a right place and right time to do the release.
Status: NEW → ASSIGNED
Add hoa.nguyen@intel.com at the Cc: list
Erik's recent change to FreeGlobals() seems fixed the problem at the upper level. The bloatview count did went down by one. The remaining one count is a result of logging before destructor. There is no real leak. So, consider this fix fixed.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Changed QA contact to ftang@netscape.com.
QA Contact: teruko → ftang
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: