Skip to content

Commit

Permalink
Dataset Memory Management example added
Browse files Browse the repository at this point in the history
  • Loading branch information
cpiker committed Nov 6, 2023
1 parent ec59411 commit 7b33d2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions buildfiles/Linux.mak
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ test: $(BD) $(BD)/$(TARG).a $(BUILD_TEST_PROGS) $(BULID_UTIL_PROGS)
@$(BD)/TestCatalog
@echo "INFO: Running unit test for dataset builder, $(BD)/TestBuilder..."
@$(BD)/TestBuilder
@echo "INFO: Running unit test for dataset loader, $(BD)/LoadStream..."
@$(BD)/LoadStream
@echo "INFO: All test programs completed without errors"

test_spice:$(BD) $(BD)/$(TARG).a $(BUILD_TEST_PROGS) $(BULID_UTIL_PROGS)
Expand Down
7 changes: 6 additions & 1 deletion test/LoadStream.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ int main(int argc, char** argv)

size_t uSets = 0;
DasDs** lDs = DasDsBldr_getDataSets(pBldr, &uSets);

/* Let the build know that I own the datasets now... */
DasDsBldr_release(pBldr);

/* ...and I'm going to delete them */
for(size_t u = 0; u < uSets; ++u)
del_DasDs(lDs[u]);

Expand All @@ -57,6 +62,6 @@ int main(int argc, char** argv)
del_DasDsBldr(pBldr); /* Automatically closes the file, not sure if I like this */
del_DasIO(pIn);

daslog_info_v("%z datasets sucessfully loaded and unloaded", uSets);
daslog_info_v("%u datasets sucessfully loaded and unloaded", uSets);
return 0;
}

0 comments on commit 7b33d2e

Please sign in to comment.