Quick out of memory if I try to serailize array

I’m trying to output my query as json:

`

function index( event, rc, prc ) {
return getInstance( “User” ).all();
}

`

When I try I got java error out of memory.

If I create the array of mementos by myself I have no problem.

Is this the intended behaviour?

That’s due to the engine’s attempt to serialize the entities. You would never want to do that, in the same way that you wouldn’t want to try that with a hibernate ORM entity.

return getInstance( “User” ).all().map( function( user ){ return user.getMemento(); } );

would ensure safe memory usage.

Hi Jon,

I’ve always done what you suggested. However in the doc is clearly stated that this process is fully automated: https://quick.ortusbooks.com/serialization#usdrenderdata

That’s why I was asking.

It is automatic for single entities. Collections are only automatic when using QuickCollection instead of an array, which is not the default.

Quick 3.0.0 bundling Mementifier and `asMemento` make this a bit more straightforward.

Tropicalista, look at this release notice in the “mementifier” area: https://www.ortussolutions.com/blog/quick-v300-alpha-released

Guys, thanks for the useful informations.

As a side note I wanna ask also why when I install Quick it’s installed QB#@6.5.0.

Is this normal?

It’s normal for the current stable version of quick. You should be able to update to qb 7 without issues. Quick 3 uses qb 7 by default.

Cheers,
Eric