Closed
Bug 60908
Opened 25 years ago
Closed 25 years ago
changing character-coding-->auto-detect appears to leak memory
Categories
(Core :: Internationalization, defect, P1)
Tracking
()
VERIFIED
FIXED
mozilla0.9.1
People
(Reporter: matt, Assigned: shanjian)
References
()
Details
(Keywords: intl, memory-leak, Whiteboard: ready to check in.)
Attachments
(2 files)
|
664 bytes,
patch
|
Details | Diff | Splinter Review | |
|
1.18 KB,
patch
|
Details | Diff | Splinter Review |
1. Load URL specified
2. View-->Character Coding-->Auto-detect-->Off
3. View-->Character Coding-->Auto-detect-->Japanese
(note resident memory usage using "ps v")
4. repeat steps 2 and 3
result: There appears to be in incremental memory leak every time Character
Coding is changed
Comment 1•25 years ago
|
||
over to I18N
Assignee: asa → nhotta
Status: UNCONFIRMED → NEW
Component: Browser-General → Internationalization
Ever confirmed: true
QA Contact: doronr → teruko
Comment 4•25 years ago
|
||
Changed QA contact to andreasb@netscape.com for now.
QA Contact: teruko → andreasb
| Assignee | ||
Comment 7•25 years ago
|
||
reassign to roy
Assignee: shanjian → yokoyama
Status: ASSIGNED → NEW
Updated•25 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.1
Comment 8•25 years ago
|
||
matt: i am running Purify on Window using 20010424 build; but it doesn't
complain about incremental memory leak. Purify is pretty good at
finding leaks. Can you verify if the bug still exists?
If still exists, what kind of tool do you use to reproduce this bug?
I can ask bstell to help me out for Linux problem.
| Reporter | ||
Comment 10•25 years ago
|
||
Are you using Purify 2000 or 2001? I generally find Insure++ to be more
accuruate when it comes to reporting leaks, Purify is better for API checking
(invalid parameters, handles, etc).
I wa on Linux, and using 'ps vxf' to show the RSS size of the mozilla process.
the RSS size increased incrementally each time I did the steps below.
I mostly am using Solaris now, but I can try reproducing on Linux if you like.
Mozilla's Solaris builds have been much less stable/functional than the Linux
builds so far.
Keywords: mlk
It seems that we're leaking some content nodes every time we reload the page
(whether it's by an auto-detect change or a simple reload). I recommend looking
at this with the XPCOM leak tools since they may not be leaks to something that
uses GC-based leak detection (since they may still be reachable through the JS
GC heap or something).
Comment 12•25 years ago
|
||
matt: I'd really appreciate if you could try this bug in Linux (may be using
Insure++). I'd like to identify if the leak is happening on a simple reload.
Since the auto-detect menu selection forces to page reload,
this bug may be non-i18n related.
I traced at least some of the leaks to a cycle between the nsHTMLImageElement
(an nsGenericElement) and its imgRequestProxy. But I couldn't get the NSPR log
of the imgRequestProxy data and the refcount logs to have the same |this| in them...
Comment 14•25 years ago
|
||
Matt: would you try this same test but just do a 'force' reload instead of
a character set change?
If most of the leak still occurs without changing the character set then
we should probably reassign to non-i18n.
Comment 15•25 years ago
|
||
David Baron: Is this anything to do with Auto-detect or simply leaks on reload?
If leaks on reload, then (as Brian suggests) we should assign this bug to
non-i18n.
Comment 16•25 years ago
|
||
I can't confirm this on Windows + Purify. Assign back to Shanjian.
Assignee: yokoyama → shanjian
Status: ASSIGNED → NEW
| Assignee | ||
Comment 17•25 years ago
|
||
In file "mozilla/intl/chardet/src/nsDetectionAdaptor.h", mWeakRefParser is
declared as COMPtr, that is an owning pointer. As a consequence, mOberser owns
this mWeakRefParser, and nsDetectionAdaptor owns mObserser, nsParser owns
nsDetectionAdaptor. That's a LOOP!
After I replaced COMPtr with interface pointer, those instances do get destroyed.
However, the destructor of nsDetectionAdaptor cause window debug warning message,
which say the memory block is damaged. I haven't been able to find out what is
the problem yet.
| Assignee | ||
Comment 18•25 years ago
|
||
| Assignee | ||
Comment 19•25 years ago
|
||
Frank, can you review my fix?
Brendan, could you do sr? This should be a purely XPCOM pointer issue.
Thanks!
Status: NEW → ASSIGNED
Comment 20•25 years ago
|
||
What keeps those pointers from dangling if the document or parser goes away?
/be
Comment 21•25 years ago
|
||
These two pointer used to be raw pointer in nsDetectionAdaptor.cpp
When yokoyama move it from nsDetectionAdaptor.cpp to nsDetectionAdaptor.h
in Apr 11 19:05 see (r.1.14 of nsDetectionAdaptor.cpp) , he change it to
nsCOMPtr<>
We have to keep it as non nsCOMPtr since they are
>What keeps those pointers from dangling if the document or parser goes away?
nsIParser ref to nsDetectionAdaptor (see
content/html/document/src/nsHTMLDocument.cpp )
576 nsCOMPtr <nsIParserFilter> cdetflt;
....
797 cdetflt = do_CreateInstance(NS_CHARSET_DETECTION_ADAPTOR_CONTRACTID,
798 &rv_detect);
...
862 if(cdetflt)
863 // The current implementation for SetParserFilter needs to
864 // be changed to be more XPCOM friendly. See bug #40149
865 nsCOMPtr<nsIParserFilter> oldFilter =
getter_AddRefs(mParser->SetParserFilter(cdetflt));
therefore we can guarantee that mWeakRefParser is always there.
also, Parser are owned by nsHTMLDocument itself, therefore, we can gurantee taht
the mWeakRefDocument is also there.
Comment 22•25 years ago
|
||
"also, Parser are owned by nsHTMLDocument itself, therefore, we can gurantee
that the mWeakRefDocument is also there."
Thanks -- this is all worth saying in a comment in the .h file. If someone
later changes things so that the parser can outlive the document, or some such,
that may help track down the crash.
Roy, sr=brendan@mozilla.org if you add a nice comment explaining the tree-like
ownership chain from document to parser to detector-adaptor.
/be
| Assignee | ||
Comment 23•25 years ago
|
||
comment added as suggested.
Comment 24•25 years ago
|
||
(Sorry Shanjian, I thought Roy had this bug! Anyway, sr= still stands unless
you would like me to review the comment too.)
| Assignee | ||
Comment 25•25 years ago
|
||
Comment 26•25 years ago
|
||
Memory leak. This one needs to be fixed.
| Assignee | ||
Updated•25 years ago
|
Whiteboard: ready to check in.
Comment 27•25 years ago
|
||
One question:
This bug is about incremental memory leak in Auto-detect and
filed 2000-11-21 which is nothing to do with my April check-in.
Is the incremental memory leak fixed as well?
| Assignee | ||
Comment 28•25 years ago
|
||
I have no idea when this began to happen or either we have other leakage related with
auto detection or not. I did checked all major objects allocated this auto detect, and
all of them are released after this patch.
| Assignee | ||
Comment 29•25 years ago
|
||
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Comment 30•25 years ago
|
||
The original 2000-11-21 leak was not diagnosed, so all we can do is make sure
that there are no leaks currently that can be attributed to this UI.
/be
Comment 31•25 years ago
|
||
Shanjian, how can I verify this?
You need to log in
before you can comment on or make changes to this bug.
Description
•