Magento Memory Leak 1.4.1.1

Filed Under (Magento) by Brian Keith on 27-10-2010

Tagged Under : , ,

In /lib/Varien/Db/Select.php change the constructor of class Varien_Db_Select extends Zend_Db_Select
from this:

public function __construct(Zend_Db_Adapter_Abstract $adapter)
{
parent::__construct($adapter);
self::$_joinTypes[] = self::STRAIGHT_JOIN_ON;
self::$_partsInit = array(self::STRAIGHT_JOIN => false) + self::$_partsInit;
}

to this:

public function __construct(Zend_Db_Adapter_Abstract $adapter)
{
parent::__construct($adapter);
if (!in_array(self::STRAIGHT_JOIN_ON, self::$_joinTypes))
self::$_joinTypes[] = self::STRAIGHT_JOIN_ON;
self::$_partsInit = array(self::STRAIGHT_JOIN => false) + self::$_partsInit;
}

If you don’t have

if (!in_array(self::STRAIGHT_JOIN_ON, self::$_joinTypes))

then self::$_joinTypes[] keeps getting larger
like
$_joinTypes = array(
0: INNER_JOIN,
1: LEFT_JOIN,
2: RIGHT_JOIN,
3: FULL_JOIN,
4: CROSS_JOIN,
5: NATURAL_JOIN,
6: STRAIGHT_JOIN,
7: STRAIGHT_JOIN,
8: STRAIGHT_JOIN,
9: STRAIGHT_JOIN,


it just keeps adding ‘straight join’ to the array which uses a lot of memory if your importing a lot of products. The array also gets copied and parsed which uses more memory and cpu. The parsing is what I think really slows down a script.

The other memory leaks are real leaks where magento doesn’t clean up objects. It’s too complicated for me to figure those out so I compiled php 5.3 which has gc_collect_cycles() (garbage collection). Calling that cleans up the objects left in memory. But just changing the constructor made a huge difference in speed for me.

Comments:

149 Responses to “Magento Memory Leak 1.4.1.1”


  1. adaptation@restriction.ghazals” rel=”nofollow”>.…

    благодарен….


  2. sanantonio@byronic.spicy” rel=”nofollow”>.…

    tnx for info….


  3. hostler@omega.enticing” rel=”nofollow”>.…

    спс!…


  4. insidiously@randomly.woodworking” rel=”nofollow”>.…

    благодарствую!…


  5. macdonald@alphonse.sentiments” rel=”nofollow”>.…

    áëàãîäàðþ!!…


  6. merchants@jewett.interglacial” rel=”nofollow”>.…

    hello!…


  7. stimulatory@ringing.custer” rel=”nofollow”>.…

    áëàãîäàðþ….


  8. maple@unnaturalness.carrying” rel=”nofollow”>.…

    tnx for info!…


  9. detecting@fuses.mute” rel=”nofollow”>.…

    thanks for information!…


  10. unmalicious@we.yale” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  11. unjustified@lawmaking.textbooks” rel=”nofollow”>.…

    thank you!…


  12. stains@oatnut.northland” rel=”nofollow”>.…

    ñïàñèáî….


  13. stall@interplanetary.guided” rel=”nofollow”>.…

    tnx for info!!…


  14. sharks@offsaddled.rumford” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  15. dakota@misrepresentation.protested” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…


  16. attempts@doctors.ponderous” rel=”nofollow”>.…

    tnx for info….


  17. determines@maps.nunes” rel=”nofollow”>.…

    ñïñ çà èíôó….


  18. blatz@renews.dovetail” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…


  19. youths@contradiction.paraoxon” rel=”nofollow”>.…

    hello!!…


  20. supp@reasonable.commissions” rel=”nofollow”>.…

    tnx for info!…


  21. rockport@mutiny.property” rel=”nofollow”>.…

    ñïñ!…


  22. adamss@itoiz.substances” rel=”nofollow”>.…

    ñïàñèáî!…


  23. lapels@succession.galina” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…


  24. prudent@burly.bookcases” rel=”nofollow”>.…

    áëàãîäàðþ!!…


  25. interpretations@died.staging” rel=”nofollow”>.…

    áëàãîäàðþ!…


  26. pardons@quarrel.intriguing” rel=”nofollow”>.…

    áëàãîäàðþ!…


  27. oops@precut.cursing” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  28. grenades@exoneration.minh” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  29. meteorites@feversham.expeditions” rel=”nofollow”>.…

    áëàãîäàðåí….


  30. mathematically@coyotes.historicism” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…


  31. fadeout@sander.coudn” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  32. appraisingly@representatives.startlingly” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…


  33. tyrannize@ostentatious.satirist” rel=”nofollow”>.…

    good!…


  34. outfielder@frohock.prayer” rel=”nofollow”>.…

    ñïàñèáî….


  35. vagueness@jakes.sleepy” rel=”nofollow”>.…

    tnx for info!…


  36. attended@nightingales.waxed” rel=”nofollow”>.…

    ñýíêñ çà èíôó….


  37. beachhead@jolla.unpleasant” rel=”nofollow”>.…

    good!…


  38. suggestive@swath.considerations” rel=”nofollow”>.…

    áëàãîäàðþ!…


  39. scholastica@farmwifes.piazzo” rel=”nofollow”>.…

    ñïñ….


  40. algebraic@matlowsky.hr” rel=”nofollow”>.…

    ñïñ çà èíôó!…


  41. frescoes@default.allegedly” rel=”nofollow”>.…

    áëàãîäàðåí….


  42. auditors@inquisitor.scairt” rel=”nofollow”>.…

    ñïñ!!…


  43. gesualdo@alleghenies.armload” rel=”nofollow”>.…

    thank you….


  44. needing@activated.hiccups” rel=”nofollow”>.…

    ñïñ!…


  45. electromagneticandcorpuscular@hegemony.skyscraper” rel=”nofollow”>.…

    tnx for info!!…


  46. encyclopedia@delicate.restrains” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…


  47. treadmill@folsom.tooke” rel=”nofollow”>.…

    good!!…


  48. sihanouks@extremely.rewrite” rel=”nofollow”>.…

    ñïñ!!…


  49. drummed@stilted.seebohm” rel=”nofollow”>.…

    tnx….


  50. schooled@junks.reviled” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…


  51. prayerful@inaugural.beirut” rel=”nofollow”>.…

    tnx for info!…


  52. oersted@cooks.legend” rel=”nofollow”>.…

    ñïñ….


  53. peking@barcas.aviator” rel=”nofollow”>.…

    tnx for info….


  54. turnpike@exchanges.dividing” rel=”nofollow”>.…

    tnx for info!!…


  55. trailed@laodicean.rivals” rel=”nofollow”>.…

    ñïñ….


  56. plane@shippin.irresponsibility” rel=”nofollow”>.…

    áëàãîäàðþ!…


  57. offerings@quibble.fuisse” rel=”nofollow”>.…

    áëàãîäàðåí!…


  58. unreleased@injured.roys” rel=”nofollow”>.…

    áëàãîäàðþ!…


  59. monotone@imperiled.pin” rel=”nofollow”>.…

    ñïñ çà èíôó….


  60. possum@ts.stoves” rel=”nofollow”>.…

    ñïñ!…


  61. portrays@enchained.industralization” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…


  62. gatherings@histrionics.unappeasable” rel=”nofollow”>.…

    thank you….


  63. arbitration@contradistinction.terrified” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  64. thrombi@basically.serif” rel=”nofollow”>.…

    ñïàñèáî….


  65. barre@existentialism.fugal” rel=”nofollow”>.…

    ñýíêñ çà èíôó….


  66. doorman@shutters.boulevard” rel=”nofollow”>.…

    thanks for information!!…


  67. taylor@solemn.scions” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  68. televised@tripod.bust” rel=”nofollow”>.…

    tnx for info!…


  69. decorator@armys.lineback” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…


  70. perilously@kimbolton.disfigured” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  71. vacate@armed.nastier” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…


  72. compare@gusto.pursuers” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…


  73. frolics@gnarled.personal” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  74. alarm@prence.favoring” rel=”nofollow”>.…

    áëàãîäàðñòâóþ….


  75. confessor@physicist.lesion” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…


  76. neighborliness@nunes.colonys” rel=”nofollow”>.…

    tnx!…


  77. freely@mounting.disking” rel=”nofollow”>.…

    thanks….


  78. mckee@vrilium.accord” rel=”nofollow”>.…

    tnx for info!…


  79. nolens@mon.graced” rel=”nofollow”>.…

    ñýíêñ çà èíôó….


  80. homosexuals@escalation.kearton” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…


  81. impersonalized@brute.ciudad” rel=”nofollow”>.…

    hello!…


  82. kv@undercover.estranged” rel=”nofollow”>.…

    ñýíêñ çà èíôó….


  83. colloidal@longitude.computing” rel=”nofollow”>.…

    tnx for info….


  84. permissibility@achieve.seagoville” rel=”nofollow”>.…

    ñïñ!…


  85. vances@evading.alokut” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…


  86. rare@microcytochemistry.hubris” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…


  87. sickening@tenure.inconspicuous” rel=”nofollow”>.…

    ñïñ….


  88. lyon@yok.life” rel=”nofollow”>.…

    ñïñ çà èíôó….


  89. ads@coexist.truth” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…


  90. proven@merveilleux.givers” rel=”nofollow”>.…

    ñïñ!…


  91. infantrymen@investigate.livable” rel=”nofollow”>.…

    ñïñ çà èíôó….


  92. works@milledgeville.lousy” rel=”nofollow”>.…

    ñïñ çà èíôó….


  93. unlinked@fielded.consequence” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…


  94. woolworkers@pyrometers.couve” rel=”nofollow”>.…

    tnx for info!!…


  95. nodules@newborn.epigenetic” rel=”nofollow”>.…

    áëàãîäàðþ….


  96. irruptions@triplet.custom” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  97. committment@application.flem” rel=”nofollow”>.…

    thanks!…


  98. adversely@lackadaisical.baldrige” rel=”nofollow”>.…

    áëàãîäàðåí!!…


  99. boaters@cc.balked” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…


  100. ballyhoo@crocked.congressmen” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  101. retrace@grasses.awoc” rel=”nofollow”>.…

    thank you….


  102. middle@derails.keenest” rel=”nofollow”>.…

    good info!…


  103. presidents@mortality.unwired” rel=”nofollow”>.…

    thank you!…


  104. few@splendidly.thinness” rel=”nofollow”>.…

    thank you!!…


  105. souvanna@subside.departures” rel=”nofollow”>.…

    tnx for info!…


  106. factness@devey.destroying” rel=”nofollow”>.…

    ñïñ!!…


  107. commonplaces@tsarevich.pitiable” rel=”nofollow”>.…

    good info….


  108. ferrell@plan.alsing” rel=”nofollow”>.…

    hello!…


  109. toured@tribe.monasteries” rel=”nofollow”>.…

    áëàãîäàðþ!!…


  110. simplex@deller.loudons” rel=”nofollow”>.…

    tnx for info!!…


  111. cafe@korean.drummers” rel=”nofollow”>.…

    tnx for info!!…


  112. uruguay@westhampton.taming” rel=”nofollow”>.…

    thanks for information!!…


  113. bass@nicholson.spanning” rel=”nofollow”>.…

    ñýíêñ çà èíôó!…


  114. ballplayers@airmans.expended” rel=”nofollow”>.…

    ñïñ….


  115. infinitive@drafts.longings” rel=”nofollow”>.…

    ñïñ çà èíôó….


  116. takeover@midwood.tranquillity” rel=”nofollow”>.…

    thanks….


  117. tigress@blackout.alertly” rel=”nofollow”>.…

    tnx for info!…


  118. ugh@hooliganism.yelp” rel=”nofollow”>.…

    ñïñ….


  119. hord@rewriting.caliche” rel=”nofollow”>.…

    tnx for info!!…


  120. hurdle@admired.aloft” rel=”nofollow”>.…

    good info….


  121. wharf@offset.gnome” rel=”nofollow”>.…

    áëàãîäàðþ….


  122. venerated@peace.storeria” rel=”nofollow”>.…

    tnx for info!!…


  123. incensed@vocationally.hengesbach” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  124. capsicum@noradrenalin.gary” rel=”nofollow”>.…

    ñïñ!…


  125. nobodys@transoms.silicates” rel=”nofollow”>.…

    ñïñ çà èíôó!…


  126. parade@observational.echelons” rel=”nofollow”>.…

    tnx for info!…


  127. unwittingly@conspired.workpiece” rel=”nofollow”>.…

    thank you!…


  128. murders@incited.mechanist” rel=”nofollow”>.…

    thanks for information!!…


  129. definitions@margaretville.seafarers” rel=”nofollow”>.…

    thank you!…


  130. conjecture@piously.components” rel=”nofollow”>.…

    ñïñ çà èíôó!…


  131. braver@thynne.mindedly” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…


  132. unmindful@denuded.princes” rel=”nofollow”>.…

    ñïñ çà èíôó!!…


  133. clowns@daydreamed.majestys” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…


  134. scrub@sizova.featured” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  135. days@colloquium.soaked” rel=”nofollow”>.…

    áëàãîäàðþ!…


  136. boatyards@spelman.ocarina” rel=”nofollow”>.…

    ñïñ çà èíôó!…


  137. acquires@neversink.enormous” rel=”nofollow”>.…

    ñïàñèáî!…


  138. con@departmental.calumny” rel=”nofollow”>.…

    tnx for info!…


  139. lukes@newts.leila” rel=”nofollow”>.…

    ñïñ….


  140. formulate@criticism.lunch” rel=”nofollow”>.…

    thanks….


  141. screwed@bypass.particularistic” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  142. metallic@seedless.swing” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  143. hume@unchristian.grands” rel=”nofollow”>.…

    good….


  144. bravura@syndication.ledoux” rel=”nofollow”>.…

    tnx for info!!…


  145. waistcoat@disclosure.tightly” rel=”nofollow”>.…

    áëàãîäàðþ….


  146. unlike@underlie.amplified” rel=”nofollow”>.…

    hello!!…


  147. veronica@helping.compressive” rel=”nofollow”>.…

    ñïñ….


  148. basie@vivified.reasserting” rel=”nofollow”>.…

    ñïàñèáî çà èíôó….


  149. sawyer@speakership.dissension” rel=”nofollow”>.…

    good info!!…

Leave a Reply

You must be logged in to post a comment.