473,395 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Memory usage by class files

Hi all,

I am currently working on a project which involves using a lot of code on
each page. I'm currently refactoring with a view to performance and have
discovered that when my app starts to include the class definitions it
needs, the memory gets eaten up *very* rapidly - indeed, typically, the
memory usage is TEN TIMES the size the class file occupied on the disk -
note this memory usage is only as a result of require_once() not objects
are instantiated, no code within the files has been run at this point.

(there are some hard stats below)

Has anybody else noticed this? Thought it a bit excessive? Found a more
efficient way of building the code (should I consider 'compiling' the
include files into a single one?). Unfortunately all the code is needed so
while the larger files do have more than one class definition there doesn't
seem to be much to be saved by using the autoloader.

TIA,

file mem used by require size on disk ratio
form.inc.php 704912 81766 8.62
widgets.inc.php 738800 57368 12.88
linked.inc.php 80920 7286 11.11
rawwidget.inc.php 74864 7497 9.99
iterator.inc.php 123536 11451 10.79

C.

Mar 30 '07 #1
2 2003
Hello,

on 03/30/2007 08:21 PM Colin McKinnon said the following:
Hi all,

I am currently working on a project which involves using a lot of code on
each page. I'm currently refactoring with a view to performance and have
discovered that when my app starts to include the class definitions it
needs, the memory gets eaten up *very* rapidly - indeed, typically, the
memory usage is TEN TIMES the size the class file occupied on the disk -
note this memory usage is only as a result of require_once() not objects
are instantiated, no code within the files has been run at this point.

(there are some hard stats below)

Has anybody else noticed this? Thought it a bit excessive? Found a more
efficient way of building the code (should I consider 'compiling' the
include files into a single one?). Unfortunately all the code is needed so
while the larger files do have more than one class definition there doesn't
seem to be much to be saved by using the autoloader.

TIA,

file mem used by require size on disk ratio
form.inc.php 704912 81766 8.62
widgets.inc.php 738800 57368 12.88
linked.inc.php 80920 7286 11.11
rawwidget.inc.php 74864 7497 9.99
iterator.inc.php 123536 11451 10.79
That is normal. PHP gets compiled into Zend Opcodes before executing.
That is mostly what compiled PHP takes in RAM. It has nothing to do with
classes.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Mar 31 '07 #2
Manuel Lemos wrote:
Hello,

on 03/30/2007 08:21 PM Colin McKinnon said the following:
>the memory gets eaten up *very* rapidly
That is normal. PHP gets compiled into Zend Opcodes before executing.
That is mostly what compiled PHP takes in RAM. It has nothing to do with
classes.
Thanks Manuel. I was worried it might just be me!

C.
Mar 31 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
6
by: Ganesan selvaraj | last post by:
I using C# .net. i want to split the text files based of the some condition. my source text file size may be 4 kb to 4 gb. some time when i split the i got the "out of memory exception. when i...
25
by: Zeng | last post by:
I finally narrowed down my code to this situation, quite a few (not all) of my CMyClass objects got hold up after each run of this function via the simple webpage that shows NumberEd editbox. My...
7
by: matvdl | last post by:
I have migrated my asp application to asp.net some time ago - but I am still having some difficulties in understanding the best way to mange some tasks. I currently have a page that loads a aspx...
4
by: AN | last post by:
Greetings, We make an ASP.NET web application and we host it for our customers. We have provisioned hardware and hope to be able to service around 200 customers on this hardware. The web...
6
by: Michael Isaacs | last post by:
Regarding use of enum's, I am wondering what the cost of memory is when creating the enumeration on the calling side, and then using it on the function/method side. See example below. If I...
4
by: Hermann Maier | last post by:
hi, i need to find out the memory usage of a specific function that i use in my program. this function does some recursive calculations and i want my program to display the amount of memory the...
3
by: KWienhold | last post by:
I'm currently writing an application (using Visual Studio 2003 SP1 and C#) that stores files and additional information in a single compound file using IStorage/IStream. Since files in a compound...
17
by: frederic.pica | last post by:
Greets, I've some troubles getting my memory freed by python, how can I force it to release the memory ? I've tried del and gc.collect() with no success. Here is a code sample, parsing an XML...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.