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

Stefan Kisdaroczi kisda at hispeed.ch
Wed Jan 6 17:57:37 CET 2010

Am 06.01.2010 15:38, schrieb Jonas Maebe:
> 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.

Thank you for that important hint. Are there any other options than a
custom MemoryManager to disable that ?

For the custom MemoryManager way I think I just copy the original one,
try to disable the reallocating and freeing, and preallocate more on startup.

On the other side I think its not really grave for my project, as I never
allocate anything in the realtime loops. And there are no Objects/Classes,
just plain pascal. The same code still needs to compile on a 16Bit Compiler
from 1989 (DOS based realtime system)...

Btw, about circular references :
This old compiler uses C-like header files, no interface and implementation
section. So you don't have any circular reference problems.
To get the 15 apps with 500+ units compatible to fpc and to avoid circular
references it was a lot of work, but its doable.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20100106/9836a6ff/attachment.sig>

More information about the fpc-devel mailing list