gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-devel] [task #14572] Protect gal_data_t's array and block poin


From: Antonio Diaz Diaz
Subject: [gnuastro-devel] [task #14572] Protect gal_data_t's array and block pointers
Date: Fri, 14 Jul 2017 12:21:32 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

Follow-up Comment #5, task #14572 (project gnuastro):

After reading the Gnuastro manual for a while, if I have undertood it
correctly, Gnuastro has two uses for gal_data_t objects; datasets and tiles.
The reason to use the same data type for both is to be able to implement
arbitrary tiling (two-layer tessellation, for example) without special cases
(without the first-level tiles pointing to a dataset, and N-level tiles
pointing to tiles of level N - 1).

My first idea to avoid dangling pointers under these circumstances is to
implement a reference counter in gal_data_t. Every time a new tile is created
(by one of the handling functions), the reference counter of its underlying
gal_data_t is increased. And every time a tile is freed, its own reference
counter is verified to be 0 and then the reference counter of its underlying
gal_data_t is decreased.

Also when a tile is reassigned to another dataset of the same size (as is now
done by changing manually tile->array and tile->block), the reference counter
of its old dataset is decreased, while the reference counter of its new
dataset is increased.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/task/?14572>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]