FreeRTOS + FAT 312 bytes leakage
Hello,
I working with FreeRTOS + FAT and i’ve got an intersting heap leakage on the function ff_chdir().
In fact when i’m using this function a MALLOC of the structure size (WorkingDirectory_t = 312 Bytes ) is used to reserve place for the current working directory. Until here every thing is alright, i can even call the function several times and the current working directory will be recognized. The problem happen when i kill the task that was using storage functions and recreate it, i can see that the heap wasn’t freed and it MALLOC again 312 bytes for the same structure.
I also figured out that the pointer to the structure was set to zero after having killed the task but the heap wasn’t freed.
I hope i was clear on the problem.
I’m maybe missing something like a function to free all memories allocated by FAT while i am killing the task ?
Best regards
Thank you.
FreeRTOS + FAT 312 bytes leakage
Adrien, that is a known issue.
I wrote the following function which should be called by the task before it finishes:
~~~
if( ffconfigHAS_CWD == 1 )
int ff_free_CWD_space( void )
{
WorkingDirectory_t *pxSpace;
/* Obtain the CWD used by the current task. */
pxSpace = ( WorkingDirectory_t * ) pvTaskGetThreadLocalStoragePointer( NULL, stdioCWD_THREAD_LOCAL_OFFSET );
if( pxSpace != NULL )
{
vTaskSetThreadLocalStoragePointer( NULL, stdioCWD_THREAD_LOCAL_OFFSET, ( void * ) NULL );
ffconfigFREE( pxSpace );
}
return 0;
}
endif /* ffconfigHAS_CWD */
/———————————————————–/ ~~~ It will be included in the next release.FreeRTOS + FAT 312 bytes leakage
Thank you for you answer, it’s now working perfectly.
best regards.
Adrien
FreeRTOS + FAT 312 bytes leakage
Thank you for you answer, it’s now working perfectly.
best regards.
Adrien
FreeRTOS + FAT 312 bytes leakage
Thank you for you answer, it’s now working perfectly.
best regards.
Adrien