Welcome, Guest. Please login or register.

Author Topic: Does workbench 3.1 ever reclaim memory back?  (Read 2853 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Does workbench 3.1 ever reclaim memory back?
« on: May 09, 2009, 01:59:24 PM »
A properly implemented libc should track all memory allocations made using the malloc family of operations. Similarly, a properly implememnted libc++ should do the same for anything allocated with new/new[] family of operators. Any leaks should last only as long as the application and any processes it creates remain open.

Conversely, if you use AllocMem() directly, without ever using FreeMem(), you can easily leak all your memory away, if you aren't careful.

However, not getting all the memory back that you had before launching an application isn't necessarily a leak indicator. After all, the application will open libraries and so on, which stay resident until the system is struggling to find memory for something.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Does workbench 3.1 ever reclaim memory back?
« Reply #1 on: May 09, 2009, 02:18:27 PM »
Quote

bloodline wrote:
No one here has yet mentioned Memory fragmentation... Over time the maximum size of a single allocation does down... thus you might have enough free memory (in total), but still suffer from an "out of memory" error :-)


Very true, hence the "Maximum" column in your typical avail output.

I think with OS4 (and probably MOS too), a page based allocator is used. That tends to help mitigate the problem.

In fact, wasn't there a third party patch of 3.x you could install that puts big allocations at the bottom of the free memory area and small ones at the top?
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show all replies
Re: Does workbench 3.1 ever reclaim memory back?
« Reply #2 on: May 09, 2009, 03:39:26 PM »
Quote

Piru wrote:
@Karlos

http://morphos-team.net/tlsf.html


Interesting...
int p; // A