Issue 5181 - Memory problem with new[] and delete operator on Tru64 port
Summary: Memory problem with new[] and delete operator on Tru64 port
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: 641
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 1.1 Beta
Assignee: jens-heiner.rechtien
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-22 19:26 UTC by matthias.huetsch
Modified: 2003-02-17 21:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description matthias.huetsch 2002-05-22 19:26:32 UTC
As described by Yi Wang on dev@porting.openoffice.org, there are quite a few
'operator new[]()'/'operator delete()' mismatches throughout the OOo code. Such
mismatching usage is always wrong and possible damage might not limited to the
DEC C++ compiler and the Tru64 port.

This issue is to track and ensure all fixes currently done on HEAD revisions
also go onto the OOO_STABLE_1 branch.

---------------------------------------------------------------------------------
Hi,

While we are debugging the OOo Tru64 port, we found a memory problem
with new[] and delete operator.

The OpenOffice.org code is full of new/delete calls where the new is
called with new[] and the delete omits the []. With Compaq cxx compiler,
calling new[] gets the array version of operator new.  This adds an 8
byte prefix to the array allocated through new, and returns the pointer
to the actual start of the array. It is supposed to call delete[] to
delete arrays allocated through new[] instead of using vanilla delete.

I am wondering if this causes any problem on other compilers. Is it
wrong to use delete (without [] ) on an array allocated through new[]?
Does anybody have good idea on fixing this problem?

Thanks for any ideas and comments.

Yi

P.S. An example to illustrate the problem:

$SRC_ROOT/xmloff/source/style/xmlexppr.cxx: ( array aPropIters )

   488
FilterPropertyInfoList_Impl::iterator *aPropIters =
   489                                          new
FilterPropertyInfoList_Impl::iterator[nValueCount];
   490
FilterPropertyInfoList_Impl::iterator *pPropIter = aPropIters;
    ......
    ......
   528                                  }
   529                                  delete aPropIters;
   530                          }
Comment 1 matthias.huetsch 2002-05-22 19:27:46 UTC
Assigning to Heiner for further tracking.
Comment 2 matthias.huetsch 2002-05-22 19:39:44 UTC
All fixes on HEAD revisions are currently tracked under internal bugid
#90353#.
Comment 3 matthias.huetsch 2002-05-22 20:43:48 UTC
Added 'ooo1.0' keyword, as fixes shall go into OOO_STABLE_1.
Comment 4 jens-heiner.rechtien 2002-05-23 10:17:44 UTC
Accepted.
Comment 5 jens-heiner.rechtien 2002-05-30 15:51:01 UTC
fixed:

tools/source/memtools/contnr.cxx          merged 1.2
tools/source/memtools/mempool.cxx         merged 1.2
tools/source/rc/resary.cxx                merged 1.2
tools/source/rc/resmgr.cxx                merged 1.16

svtools/inc/svarray.hxx                   merged 1.5
svtools/inc/svstdarr.hxx                  merged 1.3
svtools/source/items/itempool.cxx         merged 1.5
svtools/source/items/itemset.cxx          merged 1.8
svtools/source/items/nranges.cxx          merged 1.4
svtools/source/items/poolio.cxx           merged 1.2
svtools/source/items/poolio.hxx           merged 1.2

chaos/source/items/ipositem.cxx           merged 1.4

svx/source/editeng/editdoc.cxx            merged 1.26
svx/source/items/paraitem.cxx             fixed

sw/source/core/bastyp/init.cxx            fixed
sw/source/core/crsr/findattr.cxx          fixed
sw/source/core/doc/doccomp.cxx            merged 1.5
sw/source/core/sw3io/sw3field.cxx         merged 1.9
sw/source/core/sw3io/sw3misc.cxx          merged 1.19
sw/source/core/sw3io/sw3num.cxx           merged 1.14
sw/source/core/sw3io/sw3page.cxx          merged 1.7
sw/source/core/swg/swgstr.cxx             merged 1.4
sw/source/core/unocore/unosrch.cxx        merged 1.5
sw/source/core/unocore/unostyle.cxx       merged 1.39
sw/source/core/view/viewpg.cxx            fixed
sw/source/ui/dochdl/swdtflvr.cxx          fixed
sw/source/ui/docvw/edtwin.cxx             fixed
sw/source/ui/envelp/envfmt.cxx            merged 1.5
sw/source/ui/index/cnttab.cxx             fixed
sw/source/ui/table/tabledlg.cxx           merged 1.12
sw/source/ui/wizard/wizmulti.cxx          merged 1.3

more to come ...
Comment 6 jens-heiner.rechtien 2002-05-30 16:35:39 UTC
fixed:

sch/inc/memchrt.hxx                       fixed
sch/source/core/chaxis.cxx                fixed
sch/source/core/chdescr.cxx               merged 1.2
sch/source/core/chtmod2a.cxx              merged 1.18.6.1
sch/source/core/chtmod3d.cxx              merged 1.15
sch/source/core/chtmode9.cxx              fixed
sch/source/ui/func/undgraut.cxx           merged 1.4
sch/source/ui/func/unmultdp.cxx           merged 1.2

more to come ...
Comment 7 jens-heiner.rechtien 2002-06-05 16:45:36 UTC
fixed:

vcl/source/gdi/image.cxx                        fixed
vcl/source/gdi/jobset.cxx                       merged: 1.6
vcl/source/gdi/outdev.cxx                       fixed
vcl/source/gdi/outdev4.cxx                      fixed
vcl/source/gdi/poly2.cxx                        merged: 1.5
vcl/source/gdi/print.cxx                        fixed

svtools/source/filter.vcl/filter/filter.cxx     fixed
svtools/source/filter.vcl/filter/sgfbram.cxx    merged: 1.2
svtools/source/filter.vcl/filter/sgvmain.cxx    merged: 1.7
svtools/source/filter.vcl/filter/sgvspln.cxx    merged: 1.4
svtools/source/filter.vcl/filter/sgvtext.cxx    merged: 1.3
svtools/source/filter.vcl/ipng/ipng.cxx         fixed
svtools/source/filter.vcl/wmf/enhwmf.cxx        merged: 1.11.6.1
svtools/source/filter.vcl/wmf/winmtf.cxx        fixed
svtools/source/filter.vcl/wmf/winwmf.cxx        fixed
svtools/source/filter.vcl/wmf/wmfwr.cxx         merged: 1.5

goodies/source/filter.vcl/eos2met/eos2met.cxx   merged: 1.7
goodies/source/filter.vcl/epict/epict.cxx       merged: 1.8
goodies/source/filter.vcl/epng/epng.cxx         merged: 1.6
goodies/source/filter.vcl/icgm/bundles.cxx      fixed
goodies/source/filter.vcl/icgm/outact.cxx       merged: 1.2
goodies/source/filter.vcl/idxf/dxfreprd.cxx     merged: 1.2
goodies/source/filter.vcl/ieps/ieps.cxx         merged: 1.5
goodies/source/filter.vcl/ios2met/ios2met.cxx   merged: 1.4
goodies/source/filter.vcl/ipsd/ipsd.cxx         merged: 1.4
goodies/source/filter.vcl/itga/itga.cxx         merged: 1.3
goodies/source/filter.vcl/itiff/ccidecom.cxx    merged: 1.3
goodies/source/filter.vcl/itiff/itiff.cxx       merged: 1.3
goodies/source/filter.vcl/itiff/lzwdecom.cxx    merged: 1.2

svx/source/xoutdev/_xpoly.cxx                   merged: 1.1.1.1.32.1
svx/source/xoutdev/xout.cxx                     merged: 1.4
svx/source/xoutdev/xpool.cxx                    merged: 1.4

sd/source/filter/eppt/dinfos2.cxx               merged: 1.3
sd/source/filter/eppt/epptso.cxx                fixed
sd/source/filter/html/htmlex.cxx                not in OOO_STABLE_1
sd/source/filter/propread.cxx                   fixed
sd/source/ui/unoidl/unosrch.cxx                 merged: 1.6


more to come
Comment 8 matthias.huetsch 2002-06-28 19:19:09 UTC
Fixed (but not yet in OOO_STABLE_1)

/util/tools/source/stream/stream.cxx r1.11
/util/svtools/source/filerec/filerec.cxx r1.3
Comment 9 ooo 2002-07-09 11:00:53 UTC
in OOO_STABLE_1:
svtools/source/numbers/numhead.cxx  1.1.1.1.26.1
Comment 10 jens-heiner.rechtien 2002-08-02 14:51:59 UTC
merge in OOO_STABLE_1
/util/tools/source/stream/stream.cxx                      merged 1.11
/util/svtools/source/filerec/filerec.cxx                  fixed


Comment 11 stx123 2002-11-18 13:05:06 UTC
Hi Heiner/Matthias,
what's the status of this issue?
Do you have a timeframe for the resolution in mind?
Thanks, Stefan.
Comment 12 stx123 2002-11-26 13:34:21 UTC
removed ooo1.0 keyword in favour of target milestone "OOo 1.0.2".
Comment 13 jens-heiner.rechtien 2002-11-26 13:59:00 UTC
Hi Stefan,

there are still more cases which need to be fixed. I've just got a
bunch of new changes which need to be integrated. I fear that this
issue will be around for a few more weeks. Set target to OOo 1.0.3

Heiner
Comment 14 matthias.huetsch 2003-02-04 21:20:45 UTC
Fixed in workspace 'cws_srx644_mhu01' (will add final list of files
after integration).

Code coverage can only be guessed, but all instances of this issue
occuring during build, startup, smoke test, and a few sample document
loads have been fixed.

Regarding the target milestone, I currently see no urgent need to fix
this for 'OOo 1.0.3', thus changing target to 'OOo 1.1 Beta'.
Comment 15 matthias.huetsch 2003-02-17 21:47:41 UTC
Fix integrated into OOo 1.1 master workspace (with cvs tag SRX644_m4),
thus closing issue.

Files modified:

basic/source/basmgr/basmgr.cxx 1.20.2.1
basic/source/classes/image.cxx 1.6.22.1
basic/source/classes/sb.cxx 1.9.2.1
basic/source/comp/buffer.cxx 1.2.10.1
basic/source/runtime/step0.cxx 1.11.2.1

connectivity/source/drivers/file/FTable.cxx 1.17.10.1
connectivity/source/parse/sqlflex.l 1.15.12.1.2.1

rsc/source/tools/rscchar.cxx 1.2.24.1 90353,i5181

sax/source/expatwrap/saxwriter.cxx 1.13.20.1

sc/source/core/data/bcaslot.cxx 1.3.2.1
sc/source/core/data/column3.cxx 1.8.2.1
sc/source/core/data/markarr.cxx 1.4.16.1
sc/source/core/tool/rechead.cxx 1.1.1.1.46.1
sc/source/ui/undo/undocell.cxx 1.3.12.1

setup2/source/agenda/action.cxx 1.62.6.10.2.4.2.2
setup2/source/ui/pages/plicense.cxx 1.4.8.14.2.2
setup2/source/ui/pages/preadme.cxx 1.5.22.1.2.1

sfx2/source/appl/appquit.cxx 1.20.2.3
sfx2/source/doc/docfile.cxx 1.127.2.4

sot/source/sdstor/stgcache.hxx 1.2.36.1
sot/source/sdstor/stgdir.cxx 1.4.8.1
sot/source/sdstor/stgstrms.cxx 1.3.8.1
sot/source/sdstor/ucbstorage.cxx 1.76.2.4

stoc/source/inspect/introspection.cxx 1.16.2.1

svtools/source/control/ctrltool.cxx 1.6.26.1
svtools/source/control/ruler.cxx 1.14.2.2

svx/inc/xpolyimp.hxx 1.1.1.1.48.1
svx/source/dialog/svxruler.cxx 1.18.2.2

sw/source/core/bastyp/bparr.cxx 1.2.20.1
sw/source/core/sw3io/sw3misc.cxx 1.18.20.2

tools/bootstrp/cppdep.cxx 1.7.30.1
tools/source/communi/packethandler.cxx 1.2.32.1
tools/source/fsys/dirent.cxx 1.11.30.1
tools/source/fsys/filecopy.cxx 1.2.28.1

unotools/source/ucbhelper/ucblockbytes.cxx 1.41.10.1

vcl/source/window/splitwin.cxx 1.3.8.2
vcl/source/window/toolbox.cxx 1.57.2.2
vcl/unx/source/gdi/salgdi.cxx 1.22.4.2

xmloff/source/style/impastp4.cxx 1.10.22.1
xmloff/source/style/xmlexppr.cxx 1.36.14.1