dourang20110122 2012-01-11 16:38
浏览 55

内存不足(分配50855936)(试图分配50331646字节)

I have this query:

$start = 0;
$number_of_posts = 10;

 $sql = $db -> prepare("
            SELECT  U.username, U.offer_photo, F.activities, A.id_offer, A.offer, A.role, A.content, A.date_post, A.limit, B.type_offer, C.local  
            FROM  type_offer B, local C, offer A
            INNER JOIN users U
            ON U.id_user = A.company_users_id_user1
            INNER JOIN company F
            ON F.users_id_user = A.company_users_id_user1   
            WHERE state = 0 
            AND
            A.type_offer_id_type_offer = B.id_type_offer 
            AND
            A.local_id_local = C.id_local
            ORDER BY date_post 
            DESC LIMIT ?, ?
            ");
        $sql -> bind_param('ii',$start, $number_of_posts);
        $sql -> execute();
        $sql -> bind_result($username, $offer_photo, $actividades, $id_oferta, $oferta, $cargo, $conteudo, $data_post, $data_limite, $tipo_oferta, $local); //problem here
            $sql->fetch();
            $sql-close;

And i have memory_limit: 256M in phpinfo(); However i still getting a problem with the memory. I already tried this code without success :

set_time_limit(0);
ini_set('memory_limit', '2000M');

So my question is, the query can be optimized, or how can i increase the memory ? I don't have access to php.ini, but i think 256MB should be enough, so maybe the problem is the query.

  • 写回答

1条回答 默认 最新

  • dongyao5186 2012-01-11 16:57
    关注

    Is the u.offer_photo a blob field? If so I'd suggest rewriting the logic so you don't fetch the blob data until you actually display it.

    Even if you can get around the memory limit by increasing the allocation it's both anti-social to use excessive memory and brittle in that an increase in your database size in the future will likely break the system.

    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀