vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   $DB_site->free_result($something) question (https://vborg.vbsupport.ru/showthread.php?t=48217)

Arsenik 01-27-2003 07:41 PM

$DB_site->free_result($something) question
 
I am working on a vb hack and would like to know WHY and WHEN i am supposed to be using 'free_results()' ? Thanks for the help. :)

Logician 01-28-2003 10:43 AM

When you query the db the result is saved inside an resource (think it as a structure similiar to an array) so takes space in memory. After you processed the result within your "while fetch array" loop, you assign its values to a "real" array and at this point you are finished with your resource. So to save some memory space its suggested to delete it from memory as you dont need it anymore and free_result object does exactly this..

Arsenik 01-28-2003 03:00 PM

Ah i see thanks for the info. ;)

JulianD 01-28-2003 10:52 PM

It is recommended to use it after every fetch_array we perform? Or just when we see the need to free some space in memory.

Logician 01-29-2003 08:34 AM

Quote:

Originally posted by JulianD
It is recommended to use it after every fetch_array we perform? Or just when we see the need to free some space in memory.
It's a good habit to use it everytime array is fetched but actually it's needed when resource size is big. For example if your query returned a single line with int values, it really does not matter if you delete the resource from the memory or not but well, as a coder it does not harm to have the habit either.. :)

JulianD 01-29-2003 03:05 PM

OK thanks for the tip! :)


All times are GMT. The time now is 08:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00935 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete