Please upgrade here. These earlier versions are no longer being updated and have security issues.

Memory Allocation Error

This discussion is related to the World Flags addon.
vrijvlindervrijvlinder Papillon-Sauvage MVP

Hi I was testing this plugin and am getting memory allocation error on line 388 of the geoip.inc file of the World Flags Plugin. using Vanilla 2.0.18.4

$gi->memory_buffer = fread($gi->filehandle, $s_array['size']);

«1

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I suspect something here needs fixing,

    function geoip_open($filename, $flags) {
      $gi = new GeoIP;
      $gi->flags = $flags;
      if ($gi->flags & GEOIP_SHARED_MEMORY) {
        $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0);
        } else {
        $gi->filehandle = fopen($filename,"rb") or die( "Can not open $filename\n" );
        if ($gi->flags & GEOIP_MEMORY_CACHE) {
            $s_array = fstat($gi->filehandle);
            $gi->memory_buffer = fread($gi->filehandle, $s_array['size']);
        }
      }
    
      $gi = _setup_segments($gi);
      return $gi;
    }
    
    function geoip_close($gi) {
      if ($gi->flags & GEOIP_SHARED_MEMORY) {
        return true;
      }
    
      return fclose($gi->filehandle);
    }
    
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I am not sure what to look at here , I would like to make this plugin work without errors, does anyone use this plugin ?

  • hgtonighthgtonight ∞ · New Moderator

    I tested it on a clean 2.0.18.4 local install. It worked well.

    The data file this thing loads is 17mb though. I am guessing that just put you over your php memory limit.

    Sorry I have no better solution. :(

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    yea the dat file is heavy , No I think the issue is with some kind of a loop that formed. I have plenty of memory. What I suspect is that when I download the dat gets messed up because it is not a mac compatible type file.

  • I haven't tried this, but there is another flag-related plugin

    http://vanillaforums.org/addon/geoipflags-plugin

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2013

    yea the only difference is that one puts a flag also on the user profile and this one does not. Something that could be added I suppose. Seems they both use the geoip .
    I will test this one...

    When I installed the first it messed up the user page in the dashboard , no style no user columns. Tried editing this and that but no success yet.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    I opened the dat file with sublime text editor to see the contents and there is not much in there except what I think are longitude and latitude IP combinations .

    It is only a list....I think maybe GEOIP_MEMORY_CACHE settings may be wrong ...

    This situation is an example of how hard it could be to test plugins in various environments. What works for me may not work for you etc...

    How can we make sure the plugins work for everyone? Or better yet why some work with everyone and why some don't.
    If I went through a list of plugins bound for deletion and had to test them, some would not work for me but they might work for you, so it may not be a problem of the plugin...

  • DenisSDenisS My brain hurts Buriram ✭✭

    I tried this plugin nothing worked at all.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    It works for some people , saying it does not work at all is not fair . Can you give reasons , error messages what happens ?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2013

    I was able to install and enable this plugin on another domain forum . It Bonked when I went to see the profile page . I disabled went to profile no Bonk, I enabled again and it worked.

    If you run into this issue. Try disabling and then enabling while you have one window on the profile open. Then refresh to see the little flag in the about box.

    When you hover the flag the name of the country pops up. The flags could be bigger I think .

    Not sure why it works for some and not for others. Maybe some other plugins one might have installed may prevent or interfere.

    Edit: I have enabled this plugin is 5 different installations and it works.

  • SrggamerSrggamer HardCore Gamer ✭✭✭

    Tested this, my website went off the roof with lag, had to manually delete it from the FTP branch of plugins.

  • mattmatt ✭✭
    edited April 2013

    Thanks for the feedback. I've been absent as was busy with work, then got married and went on honeymoon.

    I'm sorry people are having issues with it. It doesn't actually do much that requires CPU or memory, so I'm a bit concerned that people are having issues.

    You can substitute your own flag images (though it's tricky to find a good, complete set) or simply resize the flag image in HTML so that it is, say, double the size.

    If you're still having issues, please post specific details. This plugin works for me and most other people, so it must be something specific to your setup.

    Just today I have downloaded the zip and tested it and it unzipped just fine. For those who were concerned the geoip file might be platform dependent, it's not. I use a Mac as my desktop computer, and host my sites on Linux servers.

    Thanks.

    hgtonightvrijvlinder
  • jeongweejeongwee Vanilla version 2.6 ✭✭

    @vrijvlinder does this plugin works on 2.1b1? i tryed at my localhost but it doesnt working.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Yes it works, there are a few css modifications I made to it but that is all .

  • jeongweejeongwee Vanilla version 2.6 ✭✭

    @vrijvlinder where to set it?.....i don see any page for set this plugin.....
    the flag just not showing....
    any way to make it working for me...

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    It appears only in the user profile , in the about section

  • jeongweejeongwee Vanilla version 2.6 ✭✭

    still don hv flag :(
    image

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited July 2013

    ok try adding this css to the plugin's css file or to the custom.css of the theme

    .flag {
    width: 16px;
    height: 11px;
    background: url('flags.png') no-repeat;
    cursor: help;
    float: right;
    margin-right: 5px;
    margin-top: 10px;
    }
    .flag span {
    margin: 0 20px auto!important;
    position: relative!important;
    top: -95px;
    width: 100%;
    }
    

    also try the ProfileExtender plugin it adds the location by default or other fields you may want people to fill in

  • jeongweejeongwee Vanilla version 2.6 ✭✭
    edited July 2013

    @still doesnt working.....i used chrome broswer to check element theres no class="flag" =_=
    image

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    that image only shows that the css file is being called

    you need to look at the entire source

    you click the area where the flag should be and inspect that part . Because the user info is not in the panel on 2.1 you need to change the css so you can see it. I am sure it is there but in the wrong place.

Sign In or Register to comment.