Nvm, took me way to long to realize the string cache needs a different hastable
This hashtable is not tolerant over going 'over capacity'. I have to eventually swap to another solution similar to Ryans linear probing for string caching. For now I'll just abuse ram with an oversized table.
This commit is contained in:
parent
3336ab2e1c
commit
e282397bf0
@ -8,7 +8,7 @@ import "core:os"
|
||||
|
||||
import rl "vendor:raylib"
|
||||
|
||||
Font_Largest_Px_Size :: 96
|
||||
Font_Largest_Px_Size :: 32
|
||||
|
||||
Font_Size_Interval :: 2
|
||||
|
||||
|
@ -116,7 +116,7 @@ zpl_hmap_rehash :: proc( ht : ^ HMapZPL( $ Type ), new_num : u64 ) -> AllocatorE
|
||||
{
|
||||
profile(#procedure)
|
||||
// For now the prototype should never allow this to happen.
|
||||
// ensure( false, "ZPL HMAP IS REHASHING" )
|
||||
ensure( false, "ZPL HMAP IS REHASHING" )
|
||||
last_added_index : i64
|
||||
|
||||
new_ht, init_result := zpl_hmap_init_reserve( Type, ht.hashes.backing, new_num, ht.hashes.dbg_name )
|
||||
|
@ -10,9 +10,9 @@ MemoryTracker :: struct {
|
||||
entries : Array(MemoryTrackerEntry),
|
||||
}
|
||||
|
||||
Track_Memory :: true
|
||||
Track_Memory :: false
|
||||
|
||||
tracker_msg_buffer : [Kilobyte * 64]u8
|
||||
tracker_msg_buffer : [Kilobyte * 16]u8
|
||||
|
||||
memtracker_clear :: proc ( tracker : MemoryTracker ) {
|
||||
when ! Track_Memory {
|
||||
|
@ -177,7 +177,7 @@ pool_grab :: proc( pool : Pool, zero_memory := false ) -> ( block : []byte, allo
|
||||
alloc_error = .None
|
||||
|
||||
// Check the free-list first for a block
|
||||
if pool.free_list_head != nil && false // There is a very nasty memory bug with free-lists I need to solve before they can be used.
|
||||
if pool.free_list_head != nil
|
||||
{
|
||||
head := & pool.free_list_head
|
||||
|
||||
|
@ -61,8 +61,7 @@ str_cache_init :: proc( /*allocator : Allocator*/ ) -> ( cache : StringCache ) {
|
||||
cache.slab, alloc_error = slab_init( & policy, allocator = persistent_allocator(), dbg_name = dbg_name )
|
||||
verify(alloc_error == .None, "Failed to initialize the string cache" )
|
||||
|
||||
// cache.table, alloc_error = zpl_hmap_init_reserve( StringCached, persistent_slab_allocator(), 4 * Kilobyte, dbg_name )
|
||||
cache.table, alloc_error = zpl_hmap_init_reserve( StringCached, persistent_slab_allocator(), 8, dbg_name )
|
||||
cache.table, alloc_error = zpl_hmap_init_reserve( StringCached, persistent_allocator(), 1 * Megabyte, dbg_name )
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -347,8 +347,8 @@ update :: proc( delta_time : f64 ) -> b32
|
||||
|
||||
// index := 0
|
||||
widgets : Array(UI_Widget)
|
||||
widgets, alloc_error = array_init_reserve( UI_Widget, frame_slab_allocator(), 8 )
|
||||
// widgets, alloc_error = array_init_reserve( UI_Widget, frame_slab_allocator(), 4 * Kilobyte )
|
||||
// widgets, alloc_error = array_init_reserve( UI_Widget, frame_slab_allocator(), 8 )
|
||||
widgets, alloc_error = array_init_reserve( UI_Widget, frame_slab_allocator(), 4 * Kilobyte )
|
||||
widgets_ptr := & widgets
|
||||
|
||||
label_id := 0
|
||||
|
Loading…
Reference in New Issue
Block a user