Closed Bug 204634 Opened 22 years ago Closed 22 years ago

remove dynamically allocated hashtable in xpcom where possible.

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dougt, Assigned: dougt)

Details

Attachments

(1 file)

 
This sounds very general... do you have specifics here?
well, what he's referring to is class members that have this

class nsFoo {

    nsHashtable* mHashtable;
}

nsFoo::nsFoo() {
  mHashtable = new nsHashtable();
}

nsFoo::~nsFoo() {
  delete mHashtable;
}

when in reality, we could save an allocation by just saying:

class nsFoo {

    nsHashtable mHashtable;
};

so that its not new/delete'ed...
(so if anyone wants to go out and FIND this pattern in the tree (Especially in
mozilla/xpcom) it would make it way easier to fix them. If that person wants to
attach patches, even better! I'll review.
patch coming up.
Attachment #124081 - Flags: review?(alecf)
Comment on attachment 124081 [details] [diff] [review]
update for xpcom (not including obsolete)

r=alecf
Attachment #124081 - Flags: review?(alecf) → review+
Checking in components/nsNativeComponentLoader.cpp;
/cvsroot/mozilla/xpcom/components/nsNativeComponentLoader.cpp,v  <-- 
nsNativeComponentLoader.cpp
new revision: 1.94; previous revision: 1.93
done
Checking in components/nsNativeComponentLoader.h;
/cvsroot/mozilla/xpcom/components/nsNativeComponentLoader.h,v  <-- 
nsNativeComponentLoader.h
new revision: 1.18; previous revision: 1.17
done
Checking in components/xcDll.cpp;
/cvsroot/mozilla/xpcom/components/xcDll.cpp,v  <--  xcDll.cpp
new revision: 1.73; previous revision: 1.72
done
Checking in ds/nsObserverService.cpp;
/cvsroot/mozilla/xpcom/ds/nsObserverService.cpp,v  <--  nsObserverService.cpp
new revision: 3.28; previous revision: 3.27
done
Checking in glue/standalone/nsGREDirServiceProvider.cpp;
/cvsroot/mozilla/xpcom/glue/standalone/nsGREDirServiceProvider.cpp,v  <-- 
nsGREDirServiceProvider.cpp
new revision: 1.20; previous revision: 1.19
done
Checking in proxy/src/nsProxyEventPrivate.h;
/cvsroot/mozilla/xpcom/proxy/src/nsProxyEventPrivate.h,v  <--  nsProxyEventPrivate.h
new revision: 1.35; previous revision: 1.34
done
Checking in proxy/src/nsProxyObjectManager.cpp;
/cvsroot/mozilla/xpcom/proxy/src/nsProxyObjectManager.cpp,v  <-- 
nsProxyObjectManager.cpp
new revision: 1.53; previous revision: 1.52
done

should I just mark this fixed, or should we look expand this bug to other modules?
seperate bugs for seperate modules...IMO
k
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: