[fpc-pascal] Threadvar member field

African Wild Dog paintedlycaon at gmail.com
Fri Mar 17 23:51:11 CET 2017

2017-03-17 5:50 GMT-03:00 Michael Schnell <mschnell at lumino.de>:

> On 16.03.2017 19:38, African Wild Dog wrote:
>> I have a class where its instances are shared between multiple threads.
>> How can I declare one variable per instance per thread?
> Does this really make sense ?
> Accessing threadvars (in fpc) costs a lot more CPU cycles (i.e. involves
> an OS call) than accessing normal variables.
> Supposedly the way to go is to do per-thread instances of a class, that
> might reference the other classes you want to instantiate.
I have huge collection of objects (abot 1 million) in memory so if i go
with per-thread instance it will consume the entire memory ram.
I will have to redesign my classes =(.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170317/de115441/attachment.html>

More information about the fpc-pascal mailing list