Skip to content

Commit

Permalink
fixed bug with large arrays. some comment cleanup. better memory size…
Browse files Browse the repository at this point in the history
… for generateRGBImg.sms
  • Loading branch information
reginaldford committed Oct 18, 2024
1 parent 5fceff7 commit 15356ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sms_src/examples/generateRGBImg.sms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/sms -m64
#!/usr/local/bin/sms -m256
# Usage: This script demonstrates creating a rainbow gradient using colorTGA.write

{
Expand Down
5 changes: 3 additions & 2 deletions src/main/memory/sm_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@ void sm_inflate_heap(sm_heap *from, sm_heap *to) {
// Copying GC
void sm_garbage_collect() {
if (sms_heap->used != 0) {
// Fill in the heap map
sm_heap_scan(sms_heap);
// Build "to" heap if necessary, same size as current
if (sms_other_heap == NULL)
sms_other_heap = sm_new_heap(sms_heap->capacity, true);
// Clear for when we recycle a heap
// Clear other heap for when we recycle a heap
sm_heap_clear(sms_other_heap);
// Try to shake off objects from callstack with some unregistered spacers
// Try to shake off objects from callstack with unregistered spacer
if (evaluating)
sm_new_space_at(sms_other_heap, (sm_gc_count(0) % 16) * 8);
// Copy root (global context)
Expand Down
2 changes: 1 addition & 1 deletion src/main/object/sm_space.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// General purpose space of memory
sm_space *sm_new_space(uint32_t size) {
sm_space *new_space = sm_malloc(sizeof(sm_space) + sm_round_size(size));
sm_space *new_space = sm_malloc(sizeof(sm_space) + sm_round_size64(size));
new_space->my_type = SM_SPACE_TYPE;
new_space->size = size;
return new_space;
Expand Down

0 comments on commit 15356ac

Please sign in to comment.