Skip to content

Leaks #30

Description

@olebol

The whole library (maybe the json library) leaks. Might be related to the use of the libcurl library. Specifically, the leaks are occurring in the curl_slist_append function.

Tested as follows on linux:

try {
        openai::start();
        
        auto chat = openai::chat().create({
	        {"model", "gpt-4o-mini"},
	        {"messages",
		        {
			        {
				        {"role", "system"},
				        {"content", SYSTEM_PROMPT},
			        },
			        {
				        {"role", "user"},
				        {"content", query},
				        {"max_tokens", MAX_TOKENS},
			        },
		        }},
        });
        
        response = chat["choices"][0]["message"]["content"];
} catch (const exception &e) {
        cerr << "Error: " << e.what() << '\n';
        response = "I'm sorry, I'm having trouble processing your request.";
}
	
cout << response << endl;

But I've tried it with the example instead and it leaks as well.

Noticed through compiling with -g --fsanitize=true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions