You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Maxim Volkonovsky <ma...@cma.ru> on 2002/04/04 12:35:27 UTC
final memory cleanup for ICU transcoder
Hello people,
There is a small piece of code utilizing lazily allocated data clean-up
appeared in last versions of ICU library. Although it is not a vital
improvement I hope this helps to fight actual memory leaks.
Index: xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
diff -c xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp:1.1 xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp:1.2
*** xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp:1.1 Mon Mar 18 19:36:58 2002
--- xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp Mon Mar 18 23:32:37 2002
***************
*** 74,79 ****
--- 74,82 ----
#include <unicode/ucnv_err.h>
#include <unicode/ustring.h>
#include <unicode/udata.h>
+ #if (U_ICU_VERSION_MAJOR_NUM >= 2)
+ #include <unicode/uclean.h>
+ #endif
#if !defined(XML_OS390) && !defined(XML_AS400) && !defined(XML_HPUX) && !defined(XML_PTX)
***************
*** 167,172 ****
--- 170,184 ----
ICUTransService::~ICUTransService()
{
+ CleanUp();
+ }
+
+
+ void ICUTransService::CleanUp() {
+ #if (U_ICU_VERSION_MAJOR_NUM >= 2)
+ // release all lasily allocated data
+ u_cleanup();
+ #endif
}
Index: xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp
diff -c xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp:1.1 xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp:1.2
*** xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp:1.1 Mon Mar 18 19:36:58 2002
--- xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp Mon Mar 18 23:32:37 2002
***************
*** 116,121 ****
--- 116,122 ----
ICUTransService();
~ICUTransService();
+ static void CleanUp();
// -----------------------------------------------------------------------
// Implementation of the virtual transcoding service API
--- 0 ----
Best regards, mailto:maxwolf@cma.ru
Maxim
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: final memory cleanup for ICU transcoder
Posted by Tinny Ng <tn...@ca.ibm.com>.
It is appreciated if you can open a bugzilla bug report to track this patch,
just to avoid we forget and lose it.
Thanks!
Tinny
----- Original Message -----
From: "Maxim Volkonovsky" <ma...@cma.ru>
To: <xe...@xml.apache.org>
Sent: Thursday, April 04, 2002 5:35 AM
Subject: final memory cleanup for ICU transcoder
> Hello people,
>
> There is a small piece of code utilizing lazily allocated data clean-up
> appeared in last versions of ICU library. Although it is not a vital
> improvement I hope this helps to fight actual memory leaks.
>
>
> Index: xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp
> diff -c
xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp:1.1
xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp:1.2
> *** xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp:1.1
Mon Mar 18 19:36:58 2002
> --- xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.cpp Mon
Mar 18 23:32:37 2002
> ***************
> *** 74,79 ****
> --- 74,82 ----
> #include <unicode/ucnv_err.h>
> #include <unicode/ustring.h>
> #include <unicode/udata.h>
> + #if (U_ICU_VERSION_MAJOR_NUM >= 2)
> + #include <unicode/uclean.h>
> + #endif
>
>
> #if !defined(XML_OS390) && !defined(XML_AS400) && !defined(XML_HPUX) &&
!defined(XML_PTX)
> ***************
> *** 167,172 ****
> --- 170,184 ----
>
> ICUTransService::~ICUTransService()
> {
> + CleanUp();
> + }
> +
> +
> + void ICUTransService::CleanUp() {
> + #if (U_ICU_VERSION_MAJOR_NUM >= 2)
> + // release all lasily allocated data
> + u_cleanup();
> + #endif
> }
>
>
> Index: xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp
> diff -c
xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp:1.1
xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp:1.2
> *** xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp:1.1
Mon Mar 18 19:36:58 2002
> --- xerces_1_7/src/xercesc/util/Transcoders/ICU/ICUTransService.hpp Mon
Mar 18 23:32:37 2002
> ***************
> *** 116,121 ****
> --- 116,122 ----
> ICUTransService();
> ~ICUTransService();
>
> + static void CleanUp();
>
>
// -----------------------------------------------------------------------
> // Implementation of the virtual transcoding service API
> --- 0 ----
>
>
> Best regards, mailto:maxwolf@cma.ru
> Maxim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org