Recent

Author Topic: Heaps and threads  (Read 8520 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6692
Re: Heaps and threads
« Reply #45 on: November 03, 2019, 08:27:51 am »
It's because I have not described the complete implementation of the heap manager in detail. I just gave a general overview of how the common case works. All edge cases are handled (if one of the is not, then it's a bug in the implementation and it should be reported).

OK, thanks. I'm happier with "all edge cases are covered" from you than I would be from just about anybody else.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Heaps and threads
« Reply #46 on: November 03, 2019, 02:56:02 pm »
Stop the myth with "special heap for threads". Not in free pascal. Period.

It might be that some people have seen too much Microsoft stuff. Windows and the M$ C++ compiler work with TLS - Thread Local Storage. Not free pascal.
You're wrong. FPC's heap uses threadvars to keep track of each thread's allocations and lo and behold threadvars are implemented using TLS. ;)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Heaps and threads
« Reply #47 on: November 03, 2019, 03:10:09 pm »
Hmm .....

I thought that was only true in case of the "evil" external threads.
Will have a look.

Winni

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: Heaps and threads
« Reply #48 on: November 04, 2019, 09:06:47 am »
Threadvars do not know about internal vs. external threads, they always use the same mechanism. The only difference is that for external threads the threadspecific parts of the RTL are initialized lazily instead of at the start of the thread.

 

TinyPortal © 2005-2018