[ImageJ-devel] when to close cursors, was Re: [fiji-devel] imglib coding style

Stephan Saalfeld saalfeld at mpi-cbg.de
Wed Apr 14 17:34:18 CDT 2010


Cursor.hasNext() == false does not mean that the cursor is out of image
bounds and, depending on the container may still point to some data.
Image keeping track of its cursors, it is good to close them for freeing
this data.  Currently, this is important in cell containers only.

I think that the recent design changes regarding data access make this
tracking of cursors obsolete and so Cursor.close() too.  A good hint is
that Image.removeCursor() is just never called.  But I am very tired and
have to check this.

Good night,

On Wed, 2010-04-14 at 17:10 -0500, Curtis Rueden wrote:
> Hi Johannes,
> At the hackathon Steffi told me it is best practice to always close
> cursors. I had not done this in SquareTest so I committed a change
> that now does so.
> Thanks,
> Curtis
> On Wed, Apr 14, 2010 at 4:51 PM, Johannes Schindelin
> <Johannes.Schindelin at gmx.de> wrote:
>         Hi,
>         while writing a base class for JUnit tests, I realized that I
>         did not
>         close() the cursors when cursor.hasNext() returned false. Are
>         you supposed
>         to close() them even then?
>         Ciao,
>         Johannes

More information about the ImageJ-devel mailing list