Welcome Guest, Not a member yet? Register   Sign In
Memory Leak, or Coding problem ?
#1

[eluser]n8m[/eluser]
Hi all,

while testing my Application, I just stumbled over something. I used the profiler to see how many memory my application will need. After a bit of navigating on this page, I found out that the memory usage constantly began to raise. Since this page will be used by many (many) people, this can be a problem.

What I do on this page is open and parse xml files with simplexml and the usual usermanagement stuff with a database. It would be nice if someone can tell me if this has something to do with my programming, or if this is something dependend on Codeigniter.

Thanks in advance,
n8m
#2

[eluser]Matthew Lanham[/eluser]
How big are the XML Files.... if they are quite big, then they have to be loaded into memory with simplexml and this can start to add up...
#3

[eluser]n8m[/eluser]
not so big ('bout 700 Bytes). It's just a Menue, and some random Data. What I did now, is unset all simple XML Objects. But never the less, my page is Using 1Mb of Ram without much GfX.
#4

[eluser]Matthew Lanham[/eluser]
Well it shouldn't be using that much ram, however simpleXML is pretty memory intense, and its fairly slow aswell, you might want to look into a SAX parser, i had one kicking around i found that we use on a huge project over 3.4 million records split into multiple xml files of 50,000 and the SAX parser is a HUGE amount faster, and doesnt need as much ram, as it only loads in blocks, where as simpleXML loads the whole file into memory....

Just found the link:
http://code.google.com/p/pushxml/

Uses a SAX parser to pass back an object just like using simpleXML but better, give it a whirl and let me know if this helps.
#5

[eluser]n8m[/eluser]
I'll give it a try as soon I got time. Right now I just unset the simpleXML object directly after using it. The performance is ok so for. But shurely simpleXML is nothing for big XML files. I will take a look at some sax php stuff later (when i've got more time). Right now this has to be done till tomorrow Sad.

I tried pushxml, but the demo has a small error and right now I don't have the energy to debug other code then mine. But thnx anyway- this project looks quite promissing. I'm shure that was only a minor error.

Thnx
n8m
#6

[eluser]Matthew Lanham[/eluser]
Good luck, as i say we use it and i cant recall any errors, but not sure!




Theme © iAndrew 2016 - Forum software by © MyBB