a***@aol.com
2010-06-04 06:49:03 UTC
When I am enumerating items returned by an API call I use ...
with SomeEnumAPIStruct do
. . .
cbItem := <N>;
ptrEnumMemory := AllocMem(<N> * SizeOf(TEnumItem));
ptr4FreeMem := ptrEnumMemory; // for freeing because PtrEnumMemory
gets incremented
. . .
end;
// get the enumerated items into the memory block
CallEnumerate(@SomeEnumApiStruct);
This returns the <N> items in the enumeration memory.
Then I enumerate the items using . . .
for i := 0 to <N - 1> do
SomeValue := TEnumItem(PtrEnumMemory^).Element;
inc(PtrEnumMemory);
end;
Then I . . .
FreeMem(ptr4FreeMem);
Now my question, does _all_ the memory block get freed, or only one
portion equivalent to SizeOf(TEnumItem).
Alan Lloyd
with SomeEnumAPIStruct do
. . .
cbItem := <N>;
ptrEnumMemory := AllocMem(<N> * SizeOf(TEnumItem));
ptr4FreeMem := ptrEnumMemory; // for freeing because PtrEnumMemory
gets incremented
. . .
end;
// get the enumerated items into the memory block
CallEnumerate(@SomeEnumApiStruct);
This returns the <N> items in the enumeration memory.
Then I enumerate the items using . . .
for i := 0 to <N - 1> do
SomeValue := TEnumItem(PtrEnumMemory^).Element;
inc(PtrEnumMemory);
end;
Then I . . .
FreeMem(ptr4FreeMem);
Now my question, does _all_ the memory block get freed, or only one
portion equivalent to SizeOf(TEnumItem).
Alan Lloyd