Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Getting size in memory of an object in PHP?
The memory_get_usage() function can be caked before and after allocating memory to the class created.
class MyBigClass {
var $allocatedSize;
var $allMyOtherStuff;
}
function AllocateMyBigClass() {
$before = memory_get_usage();
$ret = new MyBigClass;
$after = memory_get_usage();
$ret->allocatedSize = ($after - $before);
return $ret;
}
Output will be the memory of object with respect to the environment setup.
Advertisements
