08 September 2021, 10:44 | #21 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Depends on your datastructure. We were using an array, so we just run from the back. As always with performance tuning, you have to measure the effect, to see if it really makes a difference in your case.
|
08 September 2021, 11:07 | #22 | |
Registered User
Join Date: Aug 2018
Location: Untergrund/Germany
Posts: 410
|
Quote:
Thanks for your Coda comment It was big fun to create. Regarding removing a 1000 items from LinkedList heap: there will be (1000-n) x (1000-n) comparisons if freeing is done in the reverse order you allocated them. If the heap is already filled with other items it will take even more comparisons. So this can take quite some time (tho 10s sounds too much to me). |
|
08 September 2021, 16:44 | #23 | |
Registered User
Join Date: Apr 2012
Location: Cyberspace
Posts: 57
|
Quote:
It was a singly linked list of arbitrarliy-sized malloc'd chars. I freed it by iterating from the head. Granted, this was 6 months ago or more and I tested with many different list sizes, so my recollection of the exact performance is a bit hazy. It was at least unacceptably slow in my book. Last edited by carls; 08 September 2021 at 18:46. Reason: spelin mestayk |
|
09 September 2021, 19:41 | #24 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,307
|
Memory you allocated by malloc() is automatically released when the program terminates, but it is not the operating system which does that (unfortunately) but by the compiler library that provides malloc() and free(). In that sense, "you are safe" memory wise.
The reason why that works is that the compiler library implements a memory pool, and instead of releasing each memory segment individually, it just returns the entire pool to the system. An Os-based lookalike is AllocPooled()/FreePooled() , and CreatePool()/DeletePool() to create and dispose such pools. The compiler library may not use exactly these functions, but some lookalikes. |
13 September 2021, 18:52 | #25 | |
Registered User
Join Date: Apr 2012
Location: Cyberspace
Posts: 57
|
Quote:
Thanks, reading about those now. I was wondering how that worked with the heap but I see that the pool manager allocates puddles. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HQ2x not smooth (some pictures linked so possibly slow loading) | NewDeli | support.WinUAE | 53 | 17 March 2014 12:56 |
linked games | turrican3 | support.WinUAE | 5 | 29 July 2013 22:05 |
Freeing up even more RAM? | Muzer | project.ClassicWB | 2 | 13 September 2009 13:42 |
Dragon's lair & Escape from singe's castle linked and WHDloaded problems | KONEY | support.Games | 3 | 02 August 2009 16:44 |
Workbench 3.0 - Freeing up more memory | vroom6sri | support.Games | 3 | 08 November 2005 21:54 |
|
|