Fatal error Allowed memory limit

Fatal error Allowed memory limit

nisliwownisliwow Posts: 4Questions: 2Answers: 0

Hello,

I have generated editor via https://editor.datatables.net/generator/index.

When table is requested, i get fatal error: Fatal error: Allowed memory size of ... bytes exhausted in ...
Table size is ~40 MBs. Am I doing sth wrong or just editor can't load this MBs of db?

Thanks in advance.

My Table:

<thead>
<tr>
    <th>col1</th>
    <th>col2</th>
    <th>col3</th>
    <th>col4</th>
</tr>
</thead>

My SQL:

CREATE TABLE IF NOT EXISTS `table` (
    `id` int(10) NOT NULL auto_increment,
    `col1` numeric(9,2),
    `col2` numeric(9,2),
    `col3` numeric(9,2),
    `col4` numeric(9,2),
    PRIMARY KEY( `id` )
);

PHP:

Editor::inst( $db, 'table', 'id' )
->fields(
Field::inst( 'col1' ),
Field::inst( 'col2' ),
Field::inst( 'col3' ),
Field::inst( 'col4' )
)
->process( $_POST )
->json();

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Try enabling server-side processing.

    How large is your database table? With client-side processing the whole table needs to be loaded into memory, which can cause issues with large tables.

    Allan

  • nisliwownisliwow Posts: 4Questions: 2Answers: 0

    I have enabled, still same error for 1.2M rows. I have decreased the test db into 30k rows, it successfully loaded.

    I have added this to php page
    ini_set('memory_limit', '10G');

    still no luck, is this normal not to be able to load this big data and i should load it by chunks?

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Did you also set DataTables to POST its request? If you post a link to the page I'd be happy to take a look at it and offer some help.

    Allan

  • nisliwownisliwow Posts: 4Questions: 2Answers: 0
    processing: true,
    serverSide: true,
    ajax: {
        url: 'php/table.php',
        type: "POST"
    }
    

    Last edit, setting POST seemed to work for my case. Thanks Allan.

This discussion has been closed.