How is it possible to check how many bytes in memory an instance of a class takes?
MineMoreGames <[email protected]> Fri, 26 Apr 2019 22:01:32 +0300
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Basically the title, I don’t think that sizeof gives me what I want but maybe it does and I’m wrong, I want to be able to calculate how much memory (RAM) my library takes overall, I’ve written a Discord bot library and it has 20K member objects in cache and it takes more than 200MB of RAM, Libraries in languages like Java (JVM) and Javascript (Node) take way less, about 50 – 70MB RAM. When I’m writing the sizeof a user instance to the console it outputs 14. So 14 bytes * 20K = 280000 bytes! Which means that it’s not logical for such big of a memory intake to occur, I guess sizeof is not what I’m looking for. Thank you for any in coming responses on that one and if anyone of you have a Discord account and would like to discuss with me about memory optimization in large scale I will be glad! ~Amit.