Understanding Transactions in user-defined procedure/function

The neo4j docs state that user defined procedures/functions get given a transaction context automatically.

I'm wanting to create ~3 million nodes in this transaction that would sensibly be better split across multiple transactions. I'm essentially working my way through 8 million nodes and 80million relationships and under certain circumstance I want to create more additional nodes

My naive approach is to work without transaction code (i.e. use the default transaction context) but this leads to out of heap error (heap of 5GB is all I can realistically afford on my 16GB box).

My second approach is to use apoc.periodic.iterate('query','action',{batchSize:10000)) in my procedure however this also leads to out of heap.

The same apoc.periodic.iterate() command in Neo4J browser works fine - i.e. only has problems when invoked inside a user defined procedure.

My third approach is to try to create new transactions inside the procedure and do my own batching. Same out of heap issue.

This leads me to believe that either 1) Neo4j won't create new transaction contexts if it detects it is already in a transaction context or 2) the parent transaction commits only if all child contexts commit. Is this correct?

If user-defined procedures/functions could be annotated with 'no transaction', I suspect that would also fix my problem as I could then manage the transactions myself

I suspect I'm missing something here!