public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Possibility to make __global_locale const to reduce RAM usage?
@ 2017-10-19 13:09 Damien George
  2017-10-19 21:41 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Damien George @ 2017-10-19 13:09 UTC (permalink / raw)
  To: newlib

Hello,

As others have already noticed (see
https://sourceware.org/ml/newlib/2017/msg00192.html and
https://sourceware.org/ml/newlib/2017/msg00368.html), since newlib 2.5.0
the locale support pulls in the __global_locale struct which takes around
360 bytes of RAM, which is a lot on a resourced constrained microcontroller.

Would it be possible to make this data structure "const" so that it goes in
.text/.rodata/ROM instead of in .data/RAM?  From a brief look at the code
it looks like this structure is usually only ever read from, not written
to, so this may be a possibility.

Best regards,
Damien.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Possibility to make __global_locale const to reduce RAM usage?
  2017-10-19 13:09 Possibility to make __global_locale const to reduce RAM usage? Damien George
@ 2017-10-19 21:41 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2017-10-19 21:41 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

On Oct 19 12:00, Damien George wrote:
> Hello,
> 
> As others have already noticed (see
> https://sourceware.org/ml/newlib/2017/msg00192.html and
> https://sourceware.org/ml/newlib/2017/msg00368.html), since newlib 2.5.0
> the locale support pulls in the __global_locale struct which takes around
> 360 bytes of RAM, which is a lot on a resourced constrained microcontroller.
> 
> Would it be possible to make this data structure "const" so that it goes in
> .text/.rodata/ROM instead of in .data/RAM?  From a brief look at the code
> it looks like this structure is usually only ever read from, not written
> to, so this may be a possibility.

It's basically written to every time you call setlocale.  Patches are
welcome which disable the localization stuff entirely for embedded
devices.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-19 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19 13:09 Possibility to make __global_locale const to reduce RAM usage? Damien George
2017-10-19 21:41 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).