V
V
v7resspect2016-12-01 12:49:24
PHP
v7resspect, 2016-12-01 12:49:24

Why does a tweet use up RAM?

When sending a tweet each time the RAM is filled with +20 MB and is not cleared. The next tweet is again a memory entry. Tracked down - this happens when uploading an image to twitter:

$reply = $cb->media_upload(array(
  'media' => DIR . '/image.jpg'
));

I tried to put it into a function in a separate file - the situation is the same. And I reset the variables with unset () and assigned null, nothing works. Help solve the issue.
PHP version 5.6.25, CentOS 6, cURL installed. Used both codebird and twitter oauth from Abraham.
Full tweet code:
require_once(DIR . '/codebird.php');
  
  \Codebird\Codebird::setConsumerKey("ХХХХХХХХХХХХХХХХ", "ХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХ");
  $cb = \Codebird\Codebird::getInstance();
  $cb->setToken("ХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХ", "ХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХХ");
  
  $reply = $cb->media_upload(array(
    'media' => DIR . '/image.jpg'
  ));
  
  $media_ids[] = $reply->media_id_string;
  $media_ids = implode(',', $media_ids);
  
  $params = array(
    'status' => "Test post by twitter oauth",
    'media_ids' => $media_ids
  );
  
  $reply = $cb->statuses_update($params);
  
  $cb->logout();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Sundukov, 2016-12-01
@alekciy

What does the consumption of RAM look like? How does PHP work (via php-fpm? as an apache module? from the command line?). 20MB of RAM goes to the PHP interpreter itself. This is fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question