Closed
Bug 82370
Opened 24 years ago
Closed 24 years ago
nsDiskCacheMap::WriteDiskCacheEntry leaks diskEntry
Categories
(Core :: Networking: Cache, defect)
Tracking
()
VERIFIED
FIXED
mozilla0.9.1
People
(Reporter: dbaron, Assigned: gordon)
Details
(Keywords: memory-leak, Whiteboard: sr=darin, r=dbaron, a=asa)
Attachments
(2 files)
|
58.27 KB,
text/html
|
Details | |
|
2.47 KB,
patch
|
Details | Diff | Splinter Review |
According to the boehm GC, we leak objects allocated at the following stack:
CreateDiskCacheEntry(nsDiskCacheBinding *)
nsDiskCacheMap::WriteDiskCacheEntry(nsDiskCacheBinding *)
nsDiskCacheDevice::DeactivateEntry(nsCacheEntry *)
nsCacheService::DeactivateEntry(nsCacheEntry *)
nsCacheService::CloseDescriptor(nsCacheEntryDescriptor *)
nsCacheEntryDescriptor::Close(void)
nsCacheEntryDescriptor::~nsCacheEntryDescriptor(void)
nsCacheEntryDescriptor::Release(void)
nsCOMPtr::assign_assuming_AddRef(nsICacheEntryDescriptor *)
nsCOMPtr::assign_with_AddRef(nsISupports *)
nsCOMPtr::operator=(nsICacheEntryDescriptor *)
nsHttpChannel::CloseCacheEntry(unsigned int)
It looks to me like the problem is that nsDiskCacheMap::WriteDiskCacheEntry
leaks the memory allocated by CreateDiskCacheEntry.
Also, it looks like there are some free memory mismatches in this code. Since
the memory is allocated with new[], it should be freed with delete[]. It might
be a good idea to have static methods on nsDiskCacheEntry for creating and
freeing padded entries, or something like that...
| Reporter | ||
Comment 1•24 years ago
|
||
This is a pretty serious memory leak and should be fixed for 0.9.1. I'll submit
a patch later today.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.1
Comment 4•24 years ago
|
||
sr=darin
| Reporter | ||
Comment 5•24 years ago
|
||
r=dbaron (although I think in the future it would be nice to have a typesafe way
of doing this, where you have the casts all in one central pair of methods for
allocating and freeing the nsDiskCacheEntry).
| Reporter | ||
Comment 6•24 years ago
|
||
Actually, one question: when you call nsCRT::zero, isn't metaSize going to be
zero since that's what nsCacheEntry::FlattenMetaData sets it to? Is that what
you want?
FlattenMetaData() initializes *size to 0, but then calls PL_DHashTableEnumerate(&
table, CalculateSize, size), which sets size to the metadata byte count.
| Reporter | ||
Comment 8•24 years ago
|
||
Ah, I see. I missed the |return| in the middle of the function. r=dbaron
Comment 9•24 years ago
|
||
a=asa on behalf of drivers
| Assignee | ||
Comment 10•24 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Whiteboard: sr=darin, r=dbaron, a=? → sr=darin, r=dbaron, a=asa
Comment 11•22 years ago
|
||
Checkins confirmed in LXR, the patches show the correct revised file except:
nsDiskCacheEntry.cpp, 1.9 is patched, instead of 1.8.
Status: RESOLVED → VERIFIED
QA Contact: tever → cacheqa
You need to log in
before you can comment on or make changes to this bug.
Description
•