ReleaseStringList
Miscellaneous functions
Description
Releases a string list previously returned by another API function (for example, CheckFileCompliance). After this call the StringListID handle is no longer valid and must not be passed to GetStringListCount or GetStringListItem.
Syntax
Delphi
function TPDFlib.ReleaseStringList(StringListID: Integer): Integer;ActiveX
Function PDFlib::ReleaseStringList(StringListID As Long) As LongDLL
int DLReleaseStringList(int InstanceID, int StringListID);Parameters
| StringListID | The ID of the string list to release, as previously returned by a producer function. |
|---|
Return values
| 0 | StringListID is invalid or does not reference a string list owned by this instance. |
|---|---|
| 1 | The list was released successfully. |
Remarks
String lists are owned by the PDFlib instance that produced them. They are freed automatically when the instance is destroyed, so explicit release is normally optional. Call ReleaseStringList in long-running processes that produce many lists (for example, a CI worker that validates hundreds of PDFs in sequence) to keep memory usage bounded.
Example
// Validate many files in a loop, releasing each result list as soon as it has been logged
var
I, Issues, Count, J: Integer;
begin
for I := 0 to Files.Count - 1 do
begin
Issues := PDF.CheckFileCompliance(Files[I], '', 1, 0);
if Issues <> 0 then
begin
Count := PDF.GetStringListCount(Issues);
for J := 1 to Count do
WriteLn(Files[I], ' : ', PDF.GetStringListItem(Issues, J));
PDF.ReleaseStringList(Issues);
end;
end;
end;