Skip to content

Commit

Permalink
Add optional malloc logging to service (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel authored May 17, 2023
1 parent f0ffa19 commit d7fa532
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion neon_gui/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,30 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from ovos_utils import wait_for_exit_signal
from ovos_utils.log import LOG
from neon_gui.service import NeonGUIService
from neon_utils.configuration_utils import init_config_dir
from neon_utils.log_utils import init_log
from neon_utils.process_utils import start_malloc, snapshot_malloc, print_malloc
from ovos_utils.process_utils import PIDLock as Lock


def main(*args, **kwargs):
init_config_dir()
init_log(log_name="gui")

malloc_running = start_malloc(stack_depth=4)
from ovos_utils.process_utils import reset_sigint_handler
reset_sigint_handler()
Lock("gui")

gui = NeonGUIService(*args, **kwargs)
gui.start()
wait_for_exit_signal()
if malloc_running:
try:
print_malloc(snapshot_malloc())
except Exception as e:
LOG.error(e)
gui.shutdown()


Expand Down

0 comments on commit d7fa532

Please sign in to comment.