mg262
19th November 2005, 13:24
The current code:AVSValue(const AVSValue* a, int size)
{ type = 'a'; array = a; array_size = size; }leaves plug-ins to allocate memory for arrays inside AVSValue. Plug-ins have no way of knowing when they can deallocate this memory, so AFAIK a memory leak occurs. This is a shame, because AVSValue arrays provide the cleanest mechanism for returning multiple clips or returning auxiliary information with clips.
Would you consider one of the following?
1. Reference counted arrays inside AVSValue
AVSValue(const smart_ptr<AVSValue> a, int size)
{ type = 'A'; smart_p = a; array_size = size; }
2. Copy-by-value arrays inside AVSValue
AVSValue(const vector<AVSValue> a)
{ type = 'A'; v = a; }
(Or one of these as a replacement for the existing mechanism if you don't think it would break inaccessible code.)
{ type = 'a'; array = a; array_size = size; }leaves plug-ins to allocate memory for arrays inside AVSValue. Plug-ins have no way of knowing when they can deallocate this memory, so AFAIK a memory leak occurs. This is a shame, because AVSValue arrays provide the cleanest mechanism for returning multiple clips or returning auxiliary information with clips.
Would you consider one of the following?
1. Reference counted arrays inside AVSValue
AVSValue(const smart_ptr<AVSValue> a, int size)
{ type = 'A'; smart_p = a; array_size = size; }
2. Copy-by-value arrays inside AVSValue
AVSValue(const vector<AVSValue> a)
{ type = 'A'; v = a; }
(Or one of these as a replacement for the existing mechanism if you don't think it would break inaccessible code.)