When a privileged thread exits, we have to use the kernel alloctor to free memory; when an unprivileged thread exits, we don't have to do anything... heap memory will be cleaned up when the address environment is torn down
This commit is contained in:
parent
44499ed46c
commit
fc35e35165
@ -194,7 +194,6 @@ if [ $answer = y ]; then
|
||||
fi
|
||||
|
||||
echo "EXTERN(up_initialize)" >>ld-locked.inc
|
||||
echo "EXTERN(lib_initialize)" >>ld-locked.inc
|
||||
echo "EXTERN(sched_setupidlefiles)" >>ld-locked.inc
|
||||
echo "EXTERN(task_create)" >>ld-locked.inc
|
||||
|
||||
|
@ -65,10 +65,11 @@ extern "C"
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
/* Hook for library initialization. No is needed now, however */
|
||||
|
||||
/* Functions contained in lib_init.c ****************************************/
|
||||
#define lib_initialize()
|
||||
|
||||
void weak_function lib_initialize(void);
|
||||
/* Functions contained in lib_streams.c *************************************/
|
||||
|
||||
#if CONFIG_NFILE_STREAMS > 0
|
||||
struct task_group_s;
|
||||
|
@ -69,18 +69,6 @@
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_initialize
|
||||
*
|
||||
* Description:
|
||||
* General library initialization hook
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void weak_const_function lib_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_stream_initialize
|
||||
*
|
||||
@ -174,7 +162,24 @@ void lib_stream_release(FAR struct task_group_s *group)
|
||||
|
||||
if (list->sl_streams[i].fs_bufstart)
|
||||
{
|
||||
#ifndef CONFIG_ARCH_ADDRENV
|
||||
/* Release memory from the user heap */
|
||||
|
||||
sched_ufree(list->sl_streams[i].fs_bufstart);
|
||||
#else
|
||||
/* If the exiting group is unprivileged, then it has an address
|
||||
* environment. Don't bother to release the memory in this case...
|
||||
* There is no point sense the memory lies in the user heap which
|
||||
* will be destroyed anyway. But if this is a privileged group,
|
||||
* when we still have to release the memory using the kernel
|
||||
* allocator.
|
||||
*/
|
||||
|
||||
if ((group->tg_flags & GROUP_FLAG_PRIVILEGED) != 0)
|
||||
{
|
||||
sched_ufree(list->sl_streams[i].fs_bufstart);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -485,16 +485,11 @@ void os_start(void)
|
||||
|
||||
up_initialize();
|
||||
|
||||
/* Initialize the C libraries (if included in the link). This
|
||||
* is done last because the libraries may depend on the above.
|
||||
/* Initialize the C libraries. This is done last because the libraries
|
||||
* may depend on the above.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
if (lib_initialize != NULL)
|
||||
#endif
|
||||
{
|
||||
lib_initialize();
|
||||
}
|
||||
|
||||
/* IDLE Group Initialization **********************************************/
|
||||
#ifdef HAVE_TASK_GROUP
|
||||
|
Loading…
Reference in New Issue
Block a user