Post Reply 
How free42's memory works?
03-20-2023, 04:11 AM (This post was last modified: 03-20-2023 04:12 AM by slabco.)
Post: #1
How free42's memory works?
unlike hp42s which has fix memory if I creat a 10*10 matrix the memory of hp42s becomes less, if I create a 1000*1000 matrix with free42 the memory is still very large and may become more sometimes. When I do some calculate with large matrix free42 quits sometimes. How free42's memory works ? It may work with mobile phone's RAM and storage memory. The calculator only has one kind of memory. so pepole can calculate how much memory can be used safely.
Who can tell the machanics? How many memory of free42's can be used safely?
Find all posts by this user
Quote this message in a reply
03-20-2023, 07:52 AM
Post: #2
RE: How free42's memory works?
(03-20-2023 04:11 AM)slabco Wrote:  Who can tell the machanics?

With Free42, the memory is managed by the C++ runtime system, so when memory has to be allocated by the calculator, it may be allocated from memory that the operating system (Windows MacOS, Linux, Android, etc.) has already given to the runtime system, or the runtime system may ask the operating system for more. In the latter case, usually more than is immediately needed is given by the operating system to the runtime system, hence an allocation can actually cause free memory (within the application) to go up.

Quote:How many memory of free42's can be used safely?

There's no easy way to tell. Free42 on a computer/phone/tablet works nothing at all like the HP-42S, which had exactly 8192 bytes of RAM (unless you cracked it open and put in more). The HP-42S fimrware managed it very closely, and always knew exactly how much unused RAM was present.

Unfortunately, wanting to know this for Free42 is sort of like wanting to know how many pages you can type into Microsoft Word, or how many tabs you can open in your web browser. At some point you'll hit a limit, but it's difficult to predict where that limit would be.

Probably before you hit the absolute limit, the performance of your computer/phone/tablet will start to suffer.
Find all posts by this user
Quote this message in a reply
03-20-2023, 01:34 PM
Post: #3
RE: How free42's memory works?
C++ might also be using "lazy allocation"
https://c-faq.com/malloc/lazyalloc.html

You need to actually use it before it gets allocated.
Find all posts by this user
Quote this message in a reply
03-21-2023, 03:53 AM (This post was last modified: 03-27-2023 03:50 AM by slabco.)
Post: #4
RE: How free42's memory works?
(03-20-2023 07:52 AM)brouhaha Wrote:  
(03-20-2023 04:11 AM)slabco Wrote:  Who can tell the machanics?

With Free42, the memory is managed by the C++ runtime system, so when memory has to be allocated by the calculator, it may be allocated from memory that the operating system (Windows MacOS, Linux, Android, etc.) has already given to the runtime system, or the runtime system may ask the operating system for more. In the latter case, usually more than is immediately needed is given by the operating system to the runtime system, hence an allocation can actually cause free memory (within the application) to go up.

Quote:How many memory of free42's can be used safely?

There's no easy way to tell. Free42 on a computer/phone/tablet works nothing at all like the HP-42S, which had exactly 8192 bytes of RAM (unless you cracked it open and put in more). The HP-42S fimrware managed it very closely, and always knew exactly how much unused RAM was present.

Unfortunately, wanting to know this for Free42 is sort of like wanting to know how many pages you can type into Microsoft Word, or how many tabs you can open in your web browser. At some point you'll hit a limit, but it's difficult to predict where that limit would be.

Probably before you hit the absolute limit, the performance of your computer/phone/tablet will start to suffer.
thank you very much for your reply!
Since free42 uses C++ runtime system to manage memory. Hp-42s has some limitation for it's programes. Such as GOT function can't jump to subroutines more than 1000 steps and for RTN fucntion Hp-42s can remember up to 8 pending return locations. Does free42 still have these limitations? Maybe it can jump more than 1000 steps and remember more locations for program to return.
Emus48 uses a file to simulate memory which a calculator has. I think free42 can do the same. Let users to choose how many memory they want. 8K-18G in settings for example. Then free42 creates a file on disk. When the app starts it can ask that much to opeartion system for use. So users can know how much memory they can use safely and make sure user's progames and data can be safely preserved on disk.
Find all posts by this user
Quote this message in a reply
03-21-2023, 04:02 AM
Post: #5
RE: How free42's memory works?
(03-20-2023 01:34 PM)KeithB Wrote:  C++ might also be using "lazy allocation"
https://c-faq.com/malloc/lazyalloc.html

You need to actually use it before it gets allocated.
Thank you very much! Understanded! That is good for program like Microsoft Word and web browser. It gives a small memory to programes at the begining. When a program needs more memory for use it can offer more. That is a good way to save memory for system.
Find all posts by this user
Quote this message in a reply
03-21-2023, 04:26 AM
Post: #6
RE: How free42's memory works?
(03-21-2023 03:53 AM)slabco Wrote:  Hp-42s has some limitation for it's programes. Such as GOT function can't jump to subroutines more than 1000 steps and for RTN fucntion Hp-42s can remember up to 8 pending return locations. Does free42 still has these limitations?

Last time I checked, Free42 allowed for up to 1024 pending returns, to cater for recursion, which it also supports (unlike the HP-42S).

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
03-27-2023, 03:49 AM
Post: #7
RE: How free42's memory works?
(03-21-2023 04:26 AM)Valentin Albillo Wrote:  
(03-21-2023 03:53 AM)slabco Wrote:  Hp-42s has some limitation for it's programes. Such as GOT function can't jump to subroutines more than 1000 steps and for RTN fucntion Hp-42s can remember up to 8 pending return locations. Does free42 still has these limitations?

Last time I checked, Free42 allowed for up to 1024 pending returns, to cater for recursion, which it also supports (unlike the HP-42S).

V.

分かりました。ありがとうございます。
Find all posts by this user
Quote this message in a reply
03-27-2023, 05:29 AM
Post: #8
RE: How free42's memory works?
(03-27-2023 03:49 AM)slabco Wrote:  
(03-21-2023 04:26 AM)Valentin Albillo Wrote:  Last time I checked, Free42 allowed for up to 1024 pending returns, to cater for recursion, which it also supports (unlike the HP-42S).

V.

分かりました。ありがとうございます

どういたしまして (You're welcome. De nada.)

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)