blob: ecb474473de8c81df4e2c055ab30cc8b1ba1c4a4 [file] [log] [blame]
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef INCLUDED_CANVAS_DEBUG_HXX
#define INCLUDED_CANVAS_DEBUG_HXX
// shared_ptr debugging
// --------------------
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
# include <sal/config.h>
# include <boost/shared_ptr.hpp>
::std::size_t find_unreachable_objects( bool );
# ifdef VERBOSE
# include <osl/diagnose.h>
# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \
BOOST_CURRENT_FUNCTION, a, \
find_unreachable_objects(true) )
# else
/** This macro shows how much memory is still used by shared_ptrs
Use this macro at places in the code where normally all shared_ptr
objects should have been deleted. You'll get the number of bytes
still contained in those objects, which quite possibly are prevented
from deletion by circular references.
*/
# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \
BOOST_CURRENT_FUNCTION, a, \
find_unreachable_objects(false) )
# endif
#else
# define SHARED_PTR_LEFTOVERS(a) ((void)0)
#endif
#endif // ! defined(INCLUDED_CANVAS_DEBUG_HXX)