aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-06-04 19:45:21 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-06-04 19:45:21 +0200
commit6c82924d0a56ca6868e89ba2559a0bf9ca07c16b (patch)
tree7263c9c3912978f68898fa85be6786436965c7b1 /src/server
parentef77d6ab12be2c6d47ff33c3e7a04884c915e97d (diff)
Start fixing memory leaks on tests.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/build.odin7
-rw-r--r--src/server/collector.odin5
-rw-r--r--src/server/documents.odin3
-rw-r--r--src/server/symbol.odin3
4 files changed, 14 insertions, 4 deletions
diff --git a/src/server/build.odin b/src/server/build.odin
index aca1796..d9e052a 100644
--- a/src/server/build.odin
+++ b/src/server/build.odin
@@ -160,7 +160,10 @@ setup_index :: proc() {
)
indexer.index = make_memory_index(symbol_collection)
- dir_exe, ok := filepath.abs(path.dir(os.args[0], context.temp_allocator))
+ dir_exe, ok := filepath.abs(
+ path.dir(os.args[0], context.temp_allocator),
+ context.temp_allocator,
+ )
if !ok {
log.error(
@@ -169,7 +172,7 @@ setup_index :: proc() {
return
}
- try_build_package(path.join({dir_exe, "builtin"}))
+ try_build_package(path.join({dir_exe, "builtin"}, context.temp_allocator))
}
free_index :: proc() {
diff --git a/src/server/collector.odin b/src/server/collector.odin
index e86fa92..eecf2ed 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -94,6 +94,11 @@ delete_symbol_collection :: proc(collection: SymbolCollection) {
}
for k, v in collection.packages {
+ for k2, v2 in v.methods {
+ delete(v2)
+ }
+ delete(v.methods)
+ delete(v.objc_structs)
delete(v.symbols)
}
diff --git a/src/server/documents.odin b/src/server/documents.odin
index d78a0d2..b874082 100644
--- a/src/server/documents.odin
+++ b/src/server/documents.odin
@@ -318,6 +318,7 @@ document_close :: proc(uri_string: string) -> common.Error {
common.delete_uri(document.uri)
delete(document.text)
+ delete(document.package_name)
document.used_text = 0
@@ -500,7 +501,7 @@ parse_imports :: proc(document: ^Document, config: ^common.Config) {
import_: Package
import_.original = imp.fullpath
import_.name = path.join(
- elems = {
+ elems = {
document.package_name,
imp.fullpath[1:len(imp.fullpath) - 1],
},
diff --git a/src/server/symbol.odin b/src/server/symbol.odin
index 39708d9..d46cf99 100644
--- a/src/server/symbol.odin
+++ b/src/server/symbol.odin
@@ -176,7 +176,7 @@ SymbolType :: enum {
Struct = 22,
Type_Function = 23,
Union = 7,
- Type = 8, //For maps, arrays, slices, dyn arrays, matrixes, etc
+ Type = 8, //For maps, arrays, slices, dyn arrays, matrixes, etc
Unresolved = 1, //Use text if not being able to resolve it.
}
@@ -223,6 +223,7 @@ free_symbol :: proc(symbol: Symbol, allocator: mem.Allocator) {
common.free_ast(v.group, allocator)
case SymbolEnumValue:
delete(v.names, allocator)
+ delete(v.ranges, allocator)
case SymbolUnionValue:
common.free_ast(v.types, allocator)
case SymbolBitSetValue: