The 'Fre()' FB keyword does not refresh the memory.The 'Fre()' FB keyword returns the amount (in bytes) of available or unused dynamic memory which is allocated at this time by the OS.

I think that the quantity of dynamic memory allocated by the OS is not constant during the program execution. The OS try to regulate the available dynamic memory quantity for the program:- When the program uses some quantity of allocated dynamic memory, the OS may allocate new memory quantity for the program, in asynchronous way.- Inversely when the program frees some quantity of dynamic memory, the OS may reclaim some memory, always in asynchronous way.

This is why the variation of the value returned by the 'Fre()' FB keyword does not necessarily follow the variation of the dynamic memory quantity used by the program.

Hi,Thank you for your replies, I don't know how fre() work, if I execute this code on a loop, the memory number indicated by fre() increases more in more

@MrSwiss Sorry, please do not take account "Results = "

I think that the best solution for calculate free ram space without use "the operating system", is to use malloc (with big allocations) on a loop, and freeing the memory (getting the maximum byte number) when malloc return an exception (memory full) This take more cpu time?

Or create my own memory manager with my own "malloc/free" for freebasic and own "malloc/free" for C code, and increase / decrease the memory number when this functions was used