Skip to content

Commit

Permalink
xmr: proper memory usage in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tsusanka authored and ph4r05 committed Sep 27, 2018
1 parent 9be1e0a commit 8c8e3f3
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/apps/monero/sign_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,22 @@


async def sign_tx(ctx, received_msg):
gc.collect()
mods = utils.unimport_begin()
state = State(ctx)

while True:
if __debug__:
log.debug(__name__, "#### F: %s, A: %s", gc.mem_free(), gc.mem_alloc())
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
gc.collect()
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())

mods = utils.unimport_begin()
result_msg, accept_msgs = await sign_tx_dispatch(state, received_msg)
gc.collect()
utils.unimport_end(mods)

if accept_msgs is None:
break
received_msg = await ctx.call(result_msg, *accept_msgs)

await ctx.write(result_msg)
del (result_msg, received_msg)
utils.unimport_end(mods)

received_msg = await ctx.read(accept_msgs)
gc.collect()

del state
utils.unimport_end(mods)
gc.collect()
return result_msg


Expand Down

0 comments on commit 8c8e3f3

Please sign in to comment.