[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-devel] [bug #51603] Lost memory when re-writing option value
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-devel] [bug #51603] Lost memory when re-writing option value |
Date: |
Fri, 28 Jul 2017 07:35:59 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0 |
URL:
<http://savannah.gnu.org/bugs/?51603>
Summary: Lost memory when re-writing option value
Project: GNU Astronomy Utilities
Submitted by: makhlaghi
Submitted on: Fri 28 Jul 2017 01:35:58 PM CEST
Category: All Gnuastro
Severity: 2 - Minor
Item Group: Addition(s)
Status: Postponed
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
On the command-line, the last invocation of a single-valued option is used as
its final value.
This is implemented in `gal_options_set_from_key' (of lib/options.c
<http://git.savannah.gnu.org/cgit/gnuastro.git/tree/lib/options.c>) by simply
giving the `set' element the value of `GAL_OPTIONS_NOT_SET'.
This is fine when the memory for the option value is static. But when it is
allocated, it will result in the loss of the allocated piece of memory (the
pointer will be changed and we loose the address of the allocated memory).
By definition, such allocated pieces of memory aren't usually larger than a
few bytes and this bug thus won't cause any problem for the user. But it would
be good if we could solve it for things to be clean as possible.
One solution that comes to my mind now is to set another flag in `struct
argp_option' (of `bootstrapped/lib/argp.h' which is modified during
bootstrapping in bootstrap.conf
<http://git.savannah.gnu.org/cgit/gnuastro.git/tree/bootstrap.conf>). This
flag can say that memory for this option value is allocated or static. Using
this flag, we can then free the space if necessary before setting the `set'
flag to `GAL_OPTIONS_NOT_SET'.
But I don't have time to implement this right now and it isn't a major issue.
So if you are interested, your help would be very welcome.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51603>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-devel] [bug #51603] Lost memory when re-writing option value,
Mohammad Akhlaghi <=