Page 1 of 1

An extension to AllocVecTagsList

Posted: Wed Dec 09, 2015 5:24 pm
by OldFart
Would it be possible and viable to add a tag to the existing AVT_-range of tags, one for allocating memory from a pool. Suggested name: AVT_MemPool, whereby its ti_Data should contain the value returned by the AllocSysObject(ASOT_MEMPOOL, TAG_END) call.
This provides some of the features of AllocVecTags to pooled memory, which currently require 'manual' interference. The main desired feature being tagged AVT_ClearWIthValue, which now requires memset() or Utility's MemSet().

Currently, there is a big number of memory-related functions available. Too many, actually. Addition of this tag MIGHT obsolete 'AllocVecPooled()', maybe even one or two others.

Just a thought.

OldFart

Re: An extension to AllocVecTagsList

Posted: Wed Dec 09, 2015 6:12 pm
by broadblues
The main desired feature being tagged AVT_ClearWIthValue, which now requires memset() or Utility's MemSet().
You realise that for the most common usage case of clearling with ZERO you can just set MEMF_CLEAR when defining the flags for the pool?

eg.

ASOPOOL_MFlags , MEMF_SHARED | MEMF_CLEAR,

Re: An extension to AllocVecTagsList

Posted: Wed Dec 09, 2015 11:15 pm
by tonyw
I think you'll find that memory allocated by AllocVecTags() comes from the system heap, hence is relatively slow to allocate.
Pooled memory is originally allocated from AllocVecTags(), but then divided up and allocated using fast allocation algorithms. The two APIs are not easily combined and there is probably nothing to gain by combining them.

Re: An extension to AllocVecTagsList

Posted: Mon Dec 14, 2015 9:37 am
by OldFart
@broadblues
ASOPOOL_MFlags , MEMF_SHARED | MEMF_CLEAR,
That one had escaped my query. Thanks, it works like I expected.

@tonyw
Thanks for clearing that up.

OldFart