At 19:58 +0200 11/7/05, Frank Heckenbach wrote:
(But again, I'm quite sure that Peter's question referred to runtime storage, so that's all kind of beside the point.)
Yep, that's true. And while I appreciate the elegance of the New( s, size ) approach, I'd still be interested to know how, or if, it is possible, at run time, to pack together GPC schema strings in a block of allocated memory, such that:
a) there is not much wasted memory (ie, wasting SizeOf(Integer) is fine, wasting 200+ bytes for a short string is not so good). b) the strings can be accessed directly (with ^String())
New is very clean, but it has a number of disadvantages:
a) Memory managers do not always work well with vast numbers of small allocations. If you know in advance that strings will be added in sequence in large quantities, you can do much better than a general memory manager.
b) Memory allocation can be a reasonably expensive operation.
c) Memory blocks inevitably have some overhead, often as much as 16 bytes, to handle the memory allocator storage information.
Of course, any solution should only be implemented after profiling demonstrates that the simple clean solution is an expensive bottleneck - I'd just like to know if there is a way to pack Schema strings together to have that as an an option. Then I can compare and contrast the expense.
The Pascal Macro Compiler is not rally what I was looking for. It's a clever little chunk of code, but it's not what I had in mind.
Thanks, Peter.