I recently get OOM issue,
heap_caps_get_free_size(MALLOC_CAP_DEFAULT) returns 112
heap_caps_get_free_size(MALLOC_CAP_INTERNAL) returns 70284
I want to use the MALLOC_CAP_INTERNAL ,
but ,
heap_caps_malloc(size, MALLOC_CAP_DEFAULT) return 0
malloc(size) return 0
heap_caps_malloc(size, MALLOC_CAP_8BIT) return 0
heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) return 0
heap_caps_malloc(size, MALLOC_CAP_DMA) return 0
heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_DMA) return 0
----
heap_caps_malloc(size, MALLOC_CAP_INTERNAL) return OK
but the memory caused
Guru Meditation Error: Core 1 panic'ed (LoadStoreError). Exception was unhandled.
----
I don't know why it reserved 70K MALLOC_CAP_INTERNAL ,
Is there any config settings that can reduce the size of MALLOC_CAP_INTERNAL ?
Thanks.
How to use the memory of MALLOC_CAP_INTERNAL ?
Re: How to use the memory of MALLOC_CAP_INTERNAL ?
Not all memory is MALLOC_CAP_DMA and MALLOC_CAP_8BIT, so it isn't "reserved" but it can't do those things.
Re: How to use the memory of MALLOC_CAP_INTERNAL ?
Thanks.
Now I know that's the IRAM and it's not able to work as the DRAM
Regards,
Terry
Now I know that's the IRAM and it's not able to work as the DRAM
Regards,
Terry
Re: How to use the memory of MALLOC_CAP_INTERNAL ?
Just share 2 ideas
1 - set all int32,int64,pointer to IRAM_ATTR
staic IRAM_ATTR int intval=0;
staic IRAM_ATTR void* ptrval=NULL;
2 - use custom allocator for std::vector<int> , etc
ptr=heap_caps_malloc(size, MALLOC_CAP_32BIT);
return ptr!=NULL?ptr:malloc(size);
Regards,
Terry
1 - set all int32,int64,pointer to IRAM_ATTR
staic IRAM_ATTR int intval=0;
staic IRAM_ATTR void* ptrval=NULL;
2 - use custom allocator for std::vector<int> , etc
ptr=heap_caps_malloc(size, MALLOC_CAP_32BIT);
return ptr!=NULL?ptr:malloc(size);
Regards,
Terry
Who is online
Users browsing this forum: No registered users and 107 guests