#include "unicode/utypes.h"
Go to the source code of this file.
Functions | |
void | u_init (UErrorCode *status) |
Initialize ICU. More... | |
void | u_cleanup (void) |
Clean up the system resources, such as allocated memory or open files, used in all ICU libraries. More... |
|
Clean up the system resources, such as allocated memory or open files, used in all ICU libraries. This will free/delete all memory owned by the ICU libraries, and return them to their original load state. All open ICU items (collators, resource bundles, converters, etc.) must be closed before calling this function, otherwise ICU may not free its allocated memory (e.g. close your converters and resource bundles before calling this function). Generally, this function should be called once just before an application exits. For applications that dynamically load and unload the ICU libraries (relatively uncommon), u_cleanup() should be called just before the library unload. u_cleanup() is not thread safe. All other threads should stop using ICU before calling this function. Any open ICU items will be left in an undefined state by u_cleanup(), and any subsequent attempt to use such an item will give unpredictable results. After calling u_cleanup(), an application may continue to use ICU by calling u_init(). An application must invoke u_init() first from one single thread before allowing other threads call u_init(). All threads existing at the time of the first thread's call to u_init() must also call u_init() themselves before continuing with other ICU operations. The use of u_cleanup() just before an application terminates is optional, but it should be called only once for performance reasons. The primary benefit is to eliminate reports of memory or resource leaks originating in ICU code from the results generated by heap analysis tools. Use this function with great care!
|
|
Initialize ICU. This function loads and initializes data items that are required internally by various ICU functions. Use of this explicit initialization is required in multi-threaded applications; in single threaded apps, use is optional, but incurs little additional cost, and is thus recommended. In multi-threaded applications, u_init() should be called in the main thread before starting additional threads, or, alternatively it can be called in each individual thread once, before other ICU functions are called in that thread. In this second scenario, the application must guarantee that the first call to u_init() happen without contention, in a single thread only. Extra, repeated, or otherwise unneeded calls to u_init() do no harm, other than taking a small amount of time.
|