mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
4892 lines
170 KiB
Plaintext
4892 lines
170 KiB
Plaintext
c.lib 1.217 (10.7.2025)
|
||
|
||
- The raise() function no longer directly calls abort() because that
|
||
function in turn would have invoked raise(SIGABRT), triggering an
|
||
infinite loop. Instead, raise() now invokes the __abort() function
|
||
which abort() would have called via raise(SIGABRT).
|
||
|
||
- fgets() no longer leverages the __getc() macro, which in the
|
||
original implementation added excessive overhead for even small
|
||
read operations. Instead, fgets() now focuses on copying data
|
||
stored in the FILE read buffer, transferring the buffered data
|
||
in bulk, if possible. The same kind of changes are present in
|
||
the gets() function.
|
||
|
||
- fputs() and puts() no longer leverage the __putc() macro. As with
|
||
the fgets() implementation, the focus is now on enabling bulk
|
||
data transfer, eliminating the __putc() macro overhead.
|
||
|
||
- fread() and fwrite() no longer leverage the __getc() and
|
||
__putc() macros. Their focus is on enabling bulk data transfer
|
||
instead.
|
||
|
||
- The setvbuf() function now correctly sets the buffer size to the
|
||
value of BUFSIZ if a buffer size of 0 is specified. Previously,
|
||
setvbuf() would have disabled buffering for the FILE instead.
|
||
Failure to allocate a buffer of the specified non-zero size is
|
||
now caught and results in the setvbuf() function to indicate
|
||
failure, setting the errno variable to ENOBUFS.
|
||
|
||
- The alloca() library function (which is a built-in function for
|
||
gcc, for example) now calls abort() rather than returning NULL.
|
||
|
||
- Changed the numeric overflow check which the calloc() function
|
||
uses to be simpler.
|
||
|
||
- The memory management debugging code in stdlib_free.c is no longer
|
||
reusing the allocation size value to indicate that an allocation
|
||
should never be freed. This indication is now stored in a separate
|
||
flags field.
|
||
|
||
- The memory debugging code in malloc() now checks if the combined
|
||
size of the management data structures and front/back padding
|
||
stay within the bounds of a 32 bit integer.
|
||
|
||
The list of memory nodes to be freed is now initialized first.
|
||
Previously, the list would be left uninitialized if the attempt to
|
||
allocate memory for memory arbitration semaphore had failed.
|
||
|
||
- The realloc() function now obtains the original size of the
|
||
allocation from a dedicated field of the data structure which
|
||
precedes the allocation, whose purpose is to track the
|
||
allocation until it is freed. Previously, obtaining the relevant
|
||
allocation size information was encapsulated by a "clever"
|
||
macro.
|
||
|
||
With memory debugging enabled, the stored allocation size no
|
||
longer says how much memory, padding included, is being used.
|
||
Instead, the requested allocation size is stored unchanged, with
|
||
the total allocation size derived from this number. The idea is
|
||
to make it harder to mistake the original allocation size for
|
||
the padded one and vice versa.
|
||
|
||
- The use of the optional slab allocator now has to be deliberately
|
||
enabled in the "stdlib_memory.h" header file.
|
||
|
||
- The minimum size of an allocation managed by the optional slab
|
||
allocator is now 16 bytes instead of 8.
|
||
|
||
- The minimum size of a slab is now 4096 bytes.
|
||
|
||
- The optional slab allocator now checks for integer overflows when
|
||
processing allocation requests, taking into account the size of
|
||
the actual allocating, including padding. The task of figuring
|
||
out how much padding is needed now rests in function which
|
||
calculates the total overhead.
|
||
|
||
|
||
amiga.lib 1.216 (10.7.2025)
|
||
|
||
- Added a 'C' implementation of the pools.lib functions which were
|
||
merged with the Kickstart/Workbench 3.0 era amiga.lib. This
|
||
implementation provides the LibDeletePool(), LibCreatePool(),
|
||
LibAllocPooled() and LibFreePooled() functions which had not
|
||
been available before in clib2.
|
||
|
||
Please note that these functions are largely obsolete and only
|
||
helpful for code which must run on Kickstart 2.04. The current
|
||
implementation performs no error checking for integer overflows,
|
||
just like the original pools.lib implementation.
|
||
|
||
|
||
c.lib 1.216 (xxx)
|
||
|
||
- Add some wchar and multibyte-string related functions to allow gcc
|
||
building a libstdc++ library with wide char support. For now, the
|
||
functions are mostly stub ones only. They can be implemented on
|
||
demand.
|
||
|
||
|
||
c.lib 1.215 (26.6.2017)
|
||
|
||
- Added -fno-aggressive-loop-optimizations option when building crtbegin.c
|
||
to work around constructor/destructor hack with GCC 5.4.0 on AmigaOS 4.
|
||
|
||
- Added -fno-builtin option to fix conflicts with builtin memset()
|
||
with GCC 5.4.0 on AmigaOS 4.
|
||
|
||
|
||
c.lib 1.214 (27.4.2017)
|
||
|
||
- Added integer overflow test to calloc().
|
||
|
||
- Tiny change in getopt_long() so that the value pointed to by longindex
|
||
is always initialized to an invalid index position (that being -1),
|
||
instead of 0. The value of 0 can break some shell commands, most notably
|
||
GNU wget.
|
||
|
||
|
||
c.lib 1.213 (4.12.2016)
|
||
|
||
- Added the __decay_unused_slabs() function which brings all currently
|
||
empty slabs which are still protected from reuse closer to getting
|
||
reused or released.
|
||
|
||
- The slab-test program now exercises the memory allocation functions
|
||
to a greater degree. Memory is allocated in random chunk sizes,
|
||
the allocations are resized (to other random chunk sizes),
|
||
33% of all allocations are randomly freed, empty slabs readied for
|
||
reuse then discarded. The output in JSON format now shows a bit
|
||
more information as to what is being done.
|
||
|
||
- Rewrote __get_slab_stats() to use setjmp() and longjmp() in the
|
||
print() callback invocation.
|
||
|
||
- __get_slab_stats() now reports how many times a slab was reused
|
||
after having stuck around in the "empty slab" list.
|
||
|
||
- Changing the slab size through an environment variable is now
|
||
a feature of the debug build.
|
||
|
||
- Small changes to allow the library to be built with SAS/C again.
|
||
This includes adding code to disable/re-enable profiling,
|
||
fixing "stdlib_profile.h" and updating the smakefiles.
|
||
|
||
- Still not sure what it does, but _CXV45 now sits along with _CX25
|
||
and _CX35 in "sas_cxv.asm". "sas_cxv54.asm" is not needed any
|
||
more.
|
||
|
||
- Found the last use of MEMF_PRIVATE which should have been compiled
|
||
only for the OS4 version.
|
||
|
||
|
||
c.lib 1.212 (27.11.2016)
|
||
|
||
- Unused slabs which get recycled are no longer reinitialized from
|
||
scratch if their chunk size matches what the allocator needed.
|
||
If the chunk size matches, the list of available chunks is
|
||
left unchanged, and just the various counters are reset.
|
||
|
||
- Added __get_slab_stats() function.
|
||
|
||
- Added support for global __slab_purge_threshold tuning variable.
|
||
|
||
|
||
c.lib 1.211 (23.11.2016)
|
||
|
||
- Added more consistency checking to the slab allocator, which is
|
||
built if DEBUG is defined in "stdlib_slab.c".
|
||
|
||
- Memory allocations are no longer guaranteed to be aligned to
|
||
64 bit word boundaries. In fact, this has not even worked
|
||
reliably in the past 10 years.
|
||
|
||
- Memory allocation request sizes are now rounded to multiples of
|
||
32 bit words (the size of an address pointer) instead to the
|
||
size of a 64 bit word.
|
||
|
||
- Reduced the memory footprint of the memory allocation management
|
||
data structures by reusing the most significant bit of the
|
||
memory allocation size. This allows many more allocations to fit
|
||
into the 32 byte chunk slabs, but limits the maximum memory
|
||
allocation size to a little less than 2 GBytes.
|
||
|
||
- Added integer overflow checks to the memory management code.
|
||
|
||
- Reduced the memory management overhead further. This cuts an
|
||
additional 8 bytes per allocation, unless neither the slab
|
||
allocator nor memory pools are available. With this reduction
|
||
the slab allocator is able to use 16 byte chunks, which cover
|
||
memory allocation requests of 1..8 bytes.
|
||
|
||
- Fixed a bug caused by returning an allocation back to a slab
|
||
which passed the wrong pointer.
|
||
|
||
|
||
c.lib 1.210 (22.11.2016)
|
||
|
||
- Added __get_slab_allocations() function which will report information
|
||
about each memory allocation made by the slab allocator which does
|
||
not come from a slab.
|
||
|
||
- If the first slab in the list of slabs which share the same chunk
|
||
size has no more room, it means that all other slabs following
|
||
it have no room either. This speeds up the test to find a slab with
|
||
free space, which can now abort and directly proceed to allocate
|
||
memory for a new slab.
|
||
|
||
- If an empty slab's decay count hits zero, it is moved to the front
|
||
of the empty slab list to be reclaimed more quickly.
|
||
|
||
- Allocations made from the slab now carry a pointer back to the
|
||
slab which they are a part of. This speeds up deallocation but
|
||
has the downside of making the smallest usable slab chunk size
|
||
64 bytes, which is double what used to be the minimum before.
|
||
|
||
|
||
c.lib 1.209 (21.11.2016)
|
||
|
||
- The maximum slab size is now 2^17 bytes (= 131072). If you request
|
||
a slab size larger than this, you will get slab sizes of 131072
|
||
bytes instead.
|
||
|
||
- Enabling the memory management debugging code no longer produces
|
||
compiler errors.
|
||
|
||
|
||
c.lib 1.208 (19.11.2016)
|
||
|
||
- Updated <stdlib.h> with new functions and data structures for
|
||
use with the slab allocator.
|
||
|
||
- Added __get_slab_usage() function which can be used to query
|
||
the slab allocator memory usage at runtime.
|
||
|
||
|
||
c.lib 1.207 (18.11.2016)
|
||
|
||
- Added a slab allocator which replaces the use of memory pools or the
|
||
plain AllocMem() operations, respectively. In order to activate the
|
||
slab allocator, choose a slab size (e.g. 2048 bytes or 4096 bytes)
|
||
and declare a global variable like this:
|
||
|
||
ULONG __slab_max_size = 2048;
|
||
|
||
Memory allocations smaller than the slab size will be made from
|
||
"slabs", i.e. large chunks of memory of the given size. Larger
|
||
allocations will be managed separately.
|
||
|
||
|
||
m.lib 1.206 (24.4.2015)
|
||
|
||
- The fscanf() family failed to parse and convert %f parameters correctly
|
||
if the respective number did not begin with a digit, but a decimal
|
||
point. Hence ".7" would not be processed, but "0.7" would.
|
||
|
||
c.lib 1.206 (24.4.2015)
|
||
|
||
- Reworked the __putc() and putc() macros to reference the 'c' input
|
||
parameter only once, and to be free of side-effects when tinkering
|
||
with the buffer position.
|
||
|
||
- isatty() had the __fd_lock() call in the wrong place, which could have
|
||
led to cleanup problems later.
|
||
|
||
- The close action in the stdio, socket and termios hook code now
|
||
also zaps the fd pointer itself after cleaning up the file descriptor
|
||
table entry.
|
||
|
||
- Removed the remains of all the stack extension and stack overflow/underflow
|
||
checking code. It never actually worked. The bit that does work is the stack
|