Pull in some staticmemory features#7595
Conversation
|
current failure is libssh2, which is a known failure |
| unsigned int listSz, const unsigned int *sizeList, | ||
| const unsigned int *distList, unsigned char* buf, unsigned int sz, | ||
| int flag, int max); | ||
| #ifdef WOLFSSL_DEBUG_MEMORY_CALLBACK |
There was a problem hiding this comment.
Please document this build option at the top of memory.c or here in the header.
| typedef struct wc_Memory wc_Memory; /* internal structure for mem bucket */ | ||
| typedef struct WOLFSSL_HEAP { | ||
| wc_Memory* ava[WOLFMEM_MAX_BUCKETS]; | ||
| #ifndef WOLFSSL_LEAN_STATIC_MEMORY |
There was a problem hiding this comment.
Please document this new build option WOLFSSL_LEAN_STATIC_MEMORY at the top of memory.c or in the header. Does it reduce code size, change pools? Does it also require use with WOLFSSL_STATIC_MEMORY... etc.
| ;; | ||
| no) | ||
| ;; | ||
| small) |
| }; | ||
|
|
||
|
|
||
| #ifdef WOLFSSL_DEBUG_MEMORY_CALLBACK |
There was a problem hiding this comment.
Can WOLFSSL_DEBUG_MEMORY_CALLBACK be used on its own without static memory?
There was a problem hiding this comment.
It would be nice if it could:
./configure CFLAGS="-DWOLFSSL_DEBUG_MEMORY_CALLBACK" && make
...
examples/client/client.c:1871:14: error: use of undeclared identifier 'WOLFSSL_DEBUG_MEMORY_ALLOC'
case WOLFSSL_DEBUG_MEMORY_ALLOC:
^
examples/client/client.c:1884:14: error: use of undeclared identifier 'WOLFSSL_DEBUG_MEMORY_FAIL'
case WOLFSSL_DEBUG_MEMORY_FAIL:
^
examples/client/client.c:1888:14: error: use of undeclared identifier 'WOLFSSL_DEBUG_MEMORY_FREE'; did you mean 'WOLFSSL_BIO_MEMORY'?
case WOLFSSL_DEBUG_MEMORY_FREE:
^~~~~~~~~~~~~~~~~~~~~~~~~
WOLFSSL_BIO_MEMORY
./wolfssl/ssl.h:473:5: note: 'WOLFSSL_BIO_MEMORY' declared here
WOLFSSL_BIO_MEMORY = 4,
^
examples/client/client.c:1892:14: error: use of undeclared identifier 'WOLFSSL_DEBUG_MEMORY_INIT'
case WOLFSSL_DEBUG_MEMORY_INIT:
^
4 errors generated.
There was a problem hiding this comment.
Maybe combine it with WOLFSSL_DEBUG_MEMORY? Instead of a new macro.
There was a problem hiding this comment.
I take that back. The build am using it on does not like _func_ so it would not build with WOLFSSL_DEBUG_MEMORY and WOLFSSL_DEBUG_MEMORY_CALLBACK.
There was a problem hiding this comment.
I left it as --enable-staticmemory only for the callback. The reasoning behind that was if using non static memory than users can override XMALLOC/XFREE to achieve close to the same thing at about the same effort as creating a callback function.
| static int wc_init_memory_heap(WOLFSSL_HEAP* heap, unsigned int listSz, | ||
| const unsigned int* sizeList, const unsigned int* distList) | ||
| { | ||
| word16 i; |
There was a problem hiding this comment.
Why listSz is unsigned int and this is word16? Can we have those types match?
|
Retest this please Jenkins |
Created during PIC18F effort.
Removes restriction of staticmemory + smallstack builds. Now that there is a global heap hint option.
Adds --enable-staticmemory=small which is a stripped down version of staticmemory (smaller struct sizes and less supporting API available).
Adds --enable-staticmemory=debug which enables setting a debugging callback function. Useful in cases where printf is not available for determining what is being alloc'd and bucket sizes being used. Example client output with example callback is :