logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Schöning <tschoen...@am-soft.de>
Subject Re: deallocating resources
Date Wed, 26 Aug 2015 06:47:52 GMT
Guten Tag jasantunes,
am Mittwoch, 26. August 2015 um 03:59 schrieben Sie:

> Every time we create a logger "instance" it allocates resources, such as:

Your example is missing here, but in general you shouldn't create
Logger instances on your own, but retrieve them using
Logger::getLogger which will take care on creating new instances and
such using an underlying LoggerRepository as maintainig container.

> Obviously, the pointer destructors won't release the logger. But is there a
> way to deallocate resources for a particular logger?

No, you would need to implement a LoggerRepository and Hierarchy to do
that on your own, which I doubt is worth the amount of work. From the
docs:

> The hierarchy is such that children link to their parent but parents
> do not have any pointers to their children.

https://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1_hierarchy.html
https://logging.apache.org/log4cxx/apidocs/classlog4cxx_1_1spi_1_1_logger_repository.html

So in your example Logger "aaa" or "bbb" don't know anything about
their children, so you can't free them currently because you don't
know if they have children or not. Additionally, loggers are often
used statically, so they have no useful scope to release them. You use
case doesn't seem to be very common.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


Mime
View raw message