SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: mysqli_free_result a no no?

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysqli_free_result a no no?

    Using mysqli_free_result is taking up more memory than not using it suprisingly.
    Could anyone verify this? If so then why should anyone want to use it?
    I'm using php 5.1. and testing by putting echo memory_get_usage() at the bottom of my scripts.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I would think you'd want to use it when making many queries with large result sets in a single script. Otherwise there's no benefit, as the resources will be freed when execution ends automatically.
    17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
    Conversion tracking, click fraud detection, A/B testing and more.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for you input, here is a quote from php.net
    "Note: You should always free your result with mysqli_free_result(), when your result object is not needed anymore."

    echo memory_get_usage();
    mysqli_free_result($res);
    echo memory_get_usage();

    The above scripts returns more memory usage for me after free_result is executed.
    What is considered large result sets? LONGBLOBS?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •