Unverified Commit 884d2609 authored by Parth Sareen's avatar Parth Sareen Committed by GitHub
Browse files

llama: add minimum memory for grammar (#10820)

parent 1f371ea9
...@@ -580,7 +580,7 @@ func SchemaToGrammar(schema []byte) []byte { ...@@ -580,7 +580,7 @@ func SchemaToGrammar(schema []byte) []byte {
defer C.free(unsafe.Pointer(cStr)) defer C.free(unsafe.Pointer(cStr))
// Allocate buffer for grammar based on schema length but with upper bound // Allocate buffer for grammar based on schema length but with upper bound
maxLen := min(1024*1024, len(schema)*4) maxLen := max(32768, min(1024*1024, len(schema)*4))
buf := make([]byte, maxLen) buf := make([]byte, maxLen)
// Call C function to convert schema to grammar // Call C function to convert schema to grammar
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment