New LIBC.LIB to improve memory allocation performance for HiTech C

69 views
Skip to first unread message

ladislau szilagyi

unread,
Jan 21, 2025, 4:35:51 AMJan 21
to RC2014-Z80
Hi,

I built , for the HiTech C compiler, an updated LIBC.LIB and an updated CRTCPM.OBJ, containing new, improved malloc, free & realloc code.


You may find there also the source code for the new allocation routines.

I made also a test, comparing the execution of two programs, one built with the old library (stressoo.com), and the other with the new library (stress.com).

The program reads all the records from an input file and writes them to an output file and the console, then executes several malloc & free calls, until all the available TPA memory is
exhausted, then prints the amount of bytes successfully allocated.

Here is a sample:

D>stress
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 35302
D>stress
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 35340
D>stress
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 35577
D>stressoo
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 31971
D>stressoo
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 31882
D>stressoo
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 31334
D>

D>stress
00000000000000000000000000000
1111111111111111111111111
22222222222222222
Total bytes allocated = 35582
D>type out.txt
00000000000000000000000000000
1111111111111111111111111
22222222222222222

D>

As you see, the new routines outperform the old ones (~4KB more bytes allocated...)

Ladislau

Reply all
Reply to author
Forward
0 new messages