[Insight-developers] Question about delete on VC++

Jisung Kim bahrahm@yahoo.com
Mon, 30 Sep 2002 09:02:49 -0700 (PDT)


And, another reason for the algorithms is that since
the  my sample container classes don't store any real
measurement values (they come from itk::Image,
itk::PointSet, or Histogram), when I use a data
mutating algorithms such as Partition, I don't want to
change order of pixels in images. For that matter, I
used Subsample class and any swapping operation in
Subsample class is only change the order of indexes in
Subsample that point to the real measurement values
leaving the order of measurement values unchanged in
images or pointsets.
 
--- "Miller, James V (Research)" <millerjv@crd.ge.com>
wrote:
> Jisung,
> 
> I am still working through your memory leak
> problems.
> 
> I noticed that you have an implementation of
> QuickSelect in the
> Statistics algorithms. Is there a reason you are not
> using the 
> versions that are in STL (std::nth_element)?
> 
> It looks like itkStatisticsAlgorithms has a lot of
> sorting and
> searching code.  Could the STL algorithms be used
> instead?
> 
> Jim
> 
> 
> 
> 
> > -----Original Message-----
> > From: Jisung Kim [mailto:bahrahm@yahoo.com]
> > Sent: Friday, September 27, 2002 1:53 PM
> > To: Jisung Kim; Miller, James V (Research);
> insight-dev-list
> > Subject: RE: [Insight-developers] Question about
> delete on VC++
> > 
> > 
> > The print out result shows exact match between
> > addresses of pointer (to nodes) and the order. 
> > 
> > 
> > --- Jisung Kim <bahrahm@yahoo.com> wrote:
> > > In a same thread.
> > > 
> > > I will do printing out address of nodes in
> creation
> > > and deletion in VC++ too. And let you know the
> > > result.
> > > 
> > > --- "Miller, James V (Research)"
> > > <millerjv@crd.ge.com>
> > > wrote:
> > > > Are those in different threads?
> > > > 
> > > > 
> > > > 
> > > > > -----Original Message-----
> > > > > From: Jisung Kim [mailto:bahrahm@yahoo.com]
> > > > > Sent: Friday, September 27, 2002 12:48 PM
> > > > > To: Miller, James V (Research);
> insight-dev-list
> > > > > Subject: RE: [Insight-developers] Question
> about
> > > > delete on VC++
> > > > > 
> > > > > 
> > > > > Yes, the tree was created by the
> > > > > itkWeightedCenteroidKdTreeGenerator and the
> > > > deletion
> > > > > logic is inside of the itkKdTree.
> > > > > 
> > > > > Is it a problem?
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > 
> > > > > --- "Miller, James V (Research)"
> > > > <millerjv@crd.ge.com>
> > > > > wrote:
> > > > > > Another thought.  Is the data allocated in
> one
> > > > > > thread and destroyed
> > > > > > in another thread?
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > > -----Original Message-----
> > > > > > > From: Miller, James V (Research) 
> > > > > > > Sent: Friday, September 27, 2002 12:07
> PM
> > > > > > > To: 'Jisung Kim'; insight-dev-list
> > > > > > > Subject: RE: [Insight-developers]
> Question
> > > > about
> > > > > > delete on VC++
> > > > > > > 
> > > > > > > 
> > > > > > > Strange.  If we were building Dlls, I
> would
> > > > say
> > > > > > that maybe we were
> > > > > > > allocating nodes in one DLL and
> deallocating
> > > > them
> > > > > > in another DLL.
> > > > > > > (I think each DLL has its own heap
> > > > management).
> > > > > > But since we are 
> > > > > > > not building DLLs, then that is not the
> > > > problem.
> > > > > > > 
> > > > > > > Have you run with VC the version that
> prints
> > > > out
> > > > > > all the node
> > > > > > > allocation and deletions?
> > > > > > > 
> > > > > > > Is there anything "inside" a node that
> is
> > > not
> > > > > > being deleted? 
> > > > > > > Perhaps a 
> > > > > > > subitem is missing a destructor that
> needs
> > > to
> > > > do
> > > > > > something 
> > > > > > > that another
> > > > > > > compiler is providing by default.
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > Friday, September 27, 2002 10:16 AM
> > > > > > > > To: insight-dev-list
> > > > > > > > Subject: [Insight-developers] Question
> > > about
> > > > > > delete on VC++
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Hi.
> > > > > > > > 
> > > > > > > > I have a question for memory
> deallocation
> > > in
> > > > > > VC++.
> > > > > > > > 
> > > > > > > > Currently, my
> > > > itkKdTreeBasedKmeansEstimatorTest
> > > > > > is
> > > > > > > > leaking memory on VC++ machine. It
> seems
> > > > like
> > > > > > that the
> > > > > > > > some of the k-d tree nodes has not
> been
> > > > deleted.
> > > > > > > > However, On linux, it didn't have any
> > > leak.
> > > > I
> > > > > > traced
> > > > > > > > the creation and deletion of nodes by
> > > print
> > > > out
> > > > > > the
> > > > > > > > address of each nodes. And the result
> > > shows
> > > > > > perfect
> > > > > > > > match between creation and deletion.
> > > > > > > > 
> > > > > > > > Is there anything more than calling
> > > "delete"
> > > > to
> > > > > > delete
> > > > > > > > an object. I think I read an article
> from
> > > MS
> > > > > > about
> > > > > > > > using delete and also assign zero to
> the
> > > > pointer
> > > > > > to
> > > > > > > > properly delete object in a long time
> ago.
> > > > Is it
> > > > > > the
> > > > > > > > case? Should I assign zero to the
> pointer
> > > > after
> > > > > > > > calling delete?
> > > > > > > > 
> > > > > > > > Thank you,
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > =====
> > > > > > > > Jisung Kim
> > > > > > > > bahrahm@yahoo.com
> > > > > > > > 106 Mason Farm Rd.
> > > > > > > > 129 Radiology Research Lab., CB# 7515
> > > > > > > > Univ. of North Carolina at Chapel Hill
> > > > > > > > Chapel Hill, NC 27599-7515
> > > > > > > > 
> > > > > > > >
> > > > > >
> > > >
> __________________________________________________
> > > > > > > > Do you Yahoo!?
> 
=== message truncated ===


=====
Jisung Kim
bahrahm@yahoo.com
106 Mason Farm Rd.
129 Radiology Research Lab., CB# 7515
Univ. of North Carolina at Chapel Hill
Chapel Hill, NC 27599-7515

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com