From http://groups.drupal.org/node/25420:

I have been trying to get Drupal 6.x to work with FeedAPI. I go through the installation process, create a feed, etc and once I try to refresh the feed to add the feed items I keep getting the following message:

error message: undefined function memory_get_usage()

The message refers to the feedapi.info file I think.

I managed to get this working on an installation of 5.x on my hosting service, HostingMatters.

Any thoughts? I searched around and can't find anything that specifically addresses this issue.

Thanks.

Comments

aron novak’s picture

Assigned: Unassigned » aron novak
Status: Active » Needs review
StatusFileSize
new673 bytes

http://hu2.php.net/manual/en/function.memory-get-peak-usage.php
Before a given PHP version, it was possible to compile such a binary without these memory-related functions.

aron novak’s picture

Priority: Normal » Critical

Should be fixed in 1.9

fioritto’s picture

I applied the patch above but I am still getting the same error message:

Fatal error: Call to undefined function: memory_get_usage() in xxxxxxxxxxxxxxxxxx/sites/all/modules/feedapi/feedapi.module on line 1273

aron novak’s picture

Status: Needs review » Needs work

Yep, the patch is broken, thanks!

aron novak’s picture

Status: Needs work » Needs review
StatusFileSize
new1.57 KB

fioritto: it would be great if you would be able to test the new patch as well. It should work now :)

fioritto’s picture

I appreciate your help.

The patch process failed:

patching file feedapi.module
Hunk #1 FAILED at 1180.
Hunk #2 FAILED at 1275.
2 out of 2 hunks FAILED -- saving rejects to file feedapi.module.rej

Here is the contents of the feedapi.module.rej file:

***************
*** 1171,1177 ****

$counter = array();
timer_start('feedapi_'. $feed->nid);
- $memory_usage = memory_get_usage();
$cron = $param;

// Step 0: Check processors and grab settings
--- 1180,1186 ----

$counter = array();
timer_start('feedapi_'. $feed->nid);
+ $memory_usage_before = function_exists('memory_get_usage') ? memory_get_usage() : 0;
$cron = $param;

// Step 0: Check processors and grab settings
***************
*** 1266,1276 ****
db_query("UPDATE {feedapi} SET next_refresh_time = %d, half_done = %d, hash = '%s' WHERE nid = %d", $next_refresh_time, $half_done, $feed->hash, $feed->nid);

// Log statistics.
_feedapi_store_stat($nid, 'update_times', time(), $timestamp);
_feedapi_store_stat($nid, 'new', $new, $timestamp);
_feedapi_store_stat($nid, 'download_num', count($items), $timestamp);
_feedapi_store_stat($nid, 'process_time', timer_read('feedapi_'. $feed->nid), $timestamp);
- _feedapi_store_stat($nid, 'memory_increase', memory_get_usage() - $memory_usage, $timestamp);
_feedapi_store_stat($nid, 'next_refresh_time', $next_refresh_time, $timestamp);

if (!$cron) {
--- 1275,1286 ----
db_query("UPDATE {feedapi} SET next_refresh_time = %d, half_done = %d, hash = '%s' WHERE nid = %d", $next_refresh_time, $half_done, $feed->hash, $feed->nid);

// Log statistics.
+ $memory_usage_after = function_exists('memory_get_usage') ? memory_get_usage() : 0;
_feedapi_store_stat($nid, 'update_times', time(), $timestamp);
_feedapi_store_stat($nid, 'new', $new, $timestamp);
_feedapi_store_stat($nid, 'download_num', count($items), $timestamp);
_feedapi_store_stat($nid, 'process_time', timer_read('feedapi_'. $feed->nid), $timestamp);
+ _feedapi_store_stat($nid, 'memory_increase', $memory_usage_after - $memory_usage_before, $timestamp);
_feedapi_store_stat($nid, 'next_refresh_time', $next_refresh_time, $timestamp);

if (!$cron) {

aron novak’s picture

fioritto: well, it's something wrong with your working copy. Are you sure that no other patches were applied?
I did a clean checkout and applied the patch without any issues.

fioritto’s picture

My bad - this patch worked. Newbie mistake, I patched the already patched file instead of the original.
Thanks much.

alex_b’s picture

Status: Needs review » Reviewed & tested by the community

RTBC.

aron novak’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thank you all for cooperating.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.