1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00
Commit Graph

23 Commits

Author SHA1 Message Date
025b183b5a Unused slabs are getting purged after adding a new slab
If a new slab is allocated, or an empty slab is reused, the list of empty slabs is now purged, if possible. Empty slabs which cannot be immediately purged "decay" and will be collected the next time a new slab is allocated or an empty slab is reused.

If a chunk is allocated and the slab which the chunk came from is fully utilized, the slab is moved to the end of its list. This should avoid searching this slab for free space before all other slabs of the same chunk size have been tested first. Slabs with free space are always placed closer to the head of the list.
2016-11-17 13:14:13 +01:00
8051da3c9a Added a slab allocator
A slab-allocator can now be used as the back-end for all memory allocations by setting __slab_max_size to a value > 0. This controls the slab size used for allocations and should be a power of 2, such as 2048 or 4096 bytes.

This change still needs testing.
2016-11-17 11:45:59 +01:00
7f0f7929ba - Updated copyright text and contact information
- Replaced ISO Latin 1 code #160 with a plain blank space (ASCII code #32) where necessary


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15305 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2015-06-10 13:13:40 +00:00
4291a0564f - The memory allocated by malloc() and friends is now of type MEMF_PRIVATE
under OS4 and beyond. The AmigaOS 2.x/3.x compatible code will still
  use MEMF_ANY in the same situation, though. Other uses of MEMF_ANY have
  been replaced as well where MEMF_PRIVATE would have made better sense.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15201 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2008-09-30 14:09:00 +00:00
b2bc0096dc - Updated the copyright text.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15079 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2006-01-08 12:06:14 +00:00
67ff2ca833 - Added another function called __reset_max_mem_stats() which will reset the
counters for "maximum amount of memory used" and "maximum number of chunks
  allocated" to the current figures for these values.

- Fixed the alloca() declaration in <stdlib.h> so that software which keys
  off the fact whether or not the alloca preprocessor symbol is defined
  will do the right thing.

- Added an optional call-back function which can be called if alloca()
  is about to return NULL, which some software does not consider.
  Rather than letting such software drop into an illegal memory access
  or worse, that call-back function will be invoked instead, which can
  print an error message and eventually call abort().


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15073 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-28 09:53:51 +00:00
1153e58366 - In libunix.a malloc(), calloc() and realloc() no longer treat a
request to allocate 0 bytes as an error, returning NULL. They all
  return a pointer sized memory chunk (= four bytes) initialized to
  NULL (= 0) instead.

- The alloca() implementation which allocates memory from the system
  rather than the local stack frame is thread-safe now. It also
  interacts with the realloc(), calloc(), free() and malloc() functions
  in that the alloca() cleanup routine is called once alloca() has
  done its job. If all the memory allocated through alloca() has been
  released no further calls to the cleanup function will be made.

- In the thread-safe library, realloc() permitted two different overlapping
  calls to succeed in trying to reallocate the same chunk of memory due to
  a race condition. Fixed.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15070 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-27 09:26:55 +00:00
a5a5e36119 - Changed the assertion message text shown in the requester window.
- The standard malloc() now sets errno to EINVAL for zero length
  allocations.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15066 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-20 19:04:10 +00:00
0459ea1fc9 - In libunix.a malloc(), calloc() and realloc() no longer treat a
request to allocate 0 bytes as an error, returning NULL. They all
  return a 1 byte memory chunk initialized to 0 instead.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15064 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-11-20 17:00:22 +00:00
81958fd44b - Tried to reduce the number of compiler warnings generated.
- The cross compiler GNUmakefile.os4 variant now also logs all warnings
  and errors to a compiler.log file.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15055 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-10-27 08:58:41 +00:00
ebf5d63bc6 - Moved all the constructor code out of "stdlib_init_exit.c" and into the
files which initialize global data, such as the new "stdlib_program_name.c"
  and "stdlib_malloc.c".

- Until I can find a way to invoke it from within the library, the
  __machine_test() function is no longer invoked.

- Tagged global data with NOCOMMON attributes.

- Added the __lib_init() and __lib_exit() functions, which are part of the
  thread-safe library and which can be used to hook up clib2 with standard
  Amiga shared library/device code. Some documentation on how to use them
  can be found in the <dos.h> header file.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14999 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-07-03 10:36:48 +00:00
ead29c1850 - Reorganized the local header files, removing redundancies.
- Dropped unused stub code which is now redundant because of
  the constructor/destructor mechanism.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14891 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-18 12:38:25 +00:00
f289140266 - Switched over the startup code and the library itself to use
constructor/destructor functions for initialization and cleanup
  purposes.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14882 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-11 13:23:18 +00:00
ec3d921f7b - Moved the signal semaphore allocation/initialization/deallocation
into a dedicated module. This also has the advantage that it's
  harder to break code by accidentally forgetting to call
  InitSemaphore() after having allocated the memory for it.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14853 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-03-03 14:20:55 +00:00
1df294c07e - The thread-safety code is now subject to conditional compilation.
Both the library and the user code need to be rebuilt with the
  preprocessor symbol __THREAD_SAFE defined to get thread-safe
  code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14843 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-02-28 10:07:35 +00:00
f51faeb168 - Added more semaphore locking around the basic stdio, memory, locale
and dirent data operations. That should do it! While the library is
  not reentrant (this is not ixemul.library) it should be thread-safe
  now. Thread-safe in the sense of POSIX 1003.1c-1995.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14842 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-02-27 21:58:21 +00:00
91028c63bc - Lost the __not_a_number and __infinity variables, including the
code which initialized them.

- Reading/changing the errno variable is no longer done directly, but
  involves accessor functions.

- References to the HUGE_VAL quantity now involve an accessor function, too.

- Changed the manner in which the __huge_val constant is initialized by
  the __math_init() function.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14824 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-02-03 16:56:20 +00:00
5191ee5660 - The V37/V40 compatibility code is no longer built for the AmigaOS4
version of the library.

- Switched over the last use of DeviceProc() to GetDeviceProc(), etc.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14798 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-01-09 15:58:02 +00:00
984c6729c1 - Updated the copyright information.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14789 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2005-01-02 09:07:21 +00:00
ad0880d204 - Changed the definition of alloca() for GCC, which now defaults
to the built-in function.

- Updated the stdio.h, stdlib.h, string.h and unistd.h header files
  to declare function prototypes for the __MEM_DEBUG versions of the
  library functions only if that preprocessor symbol is defined.

- If a SIGINT signal is caught and processed by the default signal
  handler, the localized "*** BREAK" string will be printed rather
  than the built-in one.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14786 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-12-26 10:28:57 +00:00
d74535f87f - Tried to make it possible to have debug versions of the memory
management code in the default link library along with the
  normal versions. Let's see how well this works out in the GCC
  version. SAS/C does not seem to like it...


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14785 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-12-24 18:31:38 +00:00
73e6ccc14e - Moved the memory initialization and cleanup functions into the
malloc/free code itself and updated the alloca code to do its
  own data management.

- Finally optimized the alloca() memory cleanup code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14784 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-12-24 11:46:12 +00:00
91bcdea2a2 Initial import into SourceForge CVS
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14685 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2004-07-26 16:36:55 +00:00