[fpc-devel] custom ThreadManager and MemoryMutexManager for hard realtime

Pierre Muller pierre.muller at ics-cnrs.unistra.fr
Wed Jan 6 16:25:57 CET 2010

  To complement what Jonas said,
if there is no room in the currently allocated 
Free Pascal heap, the system memory manager calls the 
system specific function SysOSAlloc 
defined in rtl/unix/sysheap.inc, for unix systems.
  This in turn calls Fpmmap function 
which does a syscall syscall_nr_mmap...
code is in rtl/linux/ossysc.inc.

  None of these two functions are function variables,
which would mean that you need to modify the rtl,
make SysOSAlloc return nil everytime,
alloc enough memory at startup to avoid
running out of memory within a run,
and recompile it if your memory manager still
calls the standard RTL underneath.

  Of course, if your own memory manager does not 
call the standard one, you should be safe.

Pierre Muller

> -----Message d'origine-----
> De : fpc-devel-bounces at lists.freepascal.org [mailto:fpc-devel-
> bounces at lists.freepascal.org] De la part de Jonas Maebe
> Envoyé : Wednesday, January 06, 2010 3:38 PM
> À : FPC developers' list
> Objet : Re: [fpc-devel] custom ThreadManager and MemoryMutexManager for
> hard realtime
> On 06 Jan 2010, at 15:25, Stefan Kisdaroczi wrote:
> > AFAIK the RTL allocs the heap on app startup, or on thread-creation
> > with 2.4.0.
> > In my code im using getmem() to alloc mem from the heap, this will
> > not generate
> > syscalls because the heap is already allocated and the RTL has its
> > own MemoryManager.
> This is not entirely correct: while the rtl does pre-allocate some
> memory from the system on startup, it can still allocate more later if
> necessary, and it can also free memory back to the system.
> Jonas
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel

More information about the fpc-devel mailing list