Re: Memory reclaim errors
Sebastian Huber <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Hello Nick,
On 01.05.23 00:52, Nick French wrote:
> The line below causes us to free the memory as it is assigned to the
> current thread
>
> (g->_next = __sfmoreglue ( d, NDYNAMIC)) == NULL)
>
> changing the local thread to global as below fixes it and the file
> handle get reused
>
> (g->_next = __sfmoreglue (_GLOBAL_REENT, NDYNAMIC)) == NULL)
>
> Any comments on our assumptions are appreciated.
does this mean the memory allocator used for
static struct _glue *
sfmoreglue (struct _reent *d, int n)
{
struct glue_with_file *g;
g = (struct glue_with_file *)
_malloc_r (d, sizeof (*g) + (n - 1) * sizeof (FILE));
if (g == NULL)
return NULL;
g->glue._next = NULL;
g->glue._niobs = n;
g->glue._iobs = &g->file;
memset (&g->file, 0, n * sizeof (FILE));
return &g->glue;
}
somehow supports thread-specific memory which is automatically freed
when the associated thread is terminated?
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: [email protected]
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/