Skip to content

Instantly share code, notes, and snippets.

@hntrmrrs
Created March 12, 2012 15:41
Show Gist options
  • Save hntrmrrs/2022778 to your computer and use it in GitHub Desktop.
Save hntrmrrs/2022778 to your computer and use it in GitHub Desktop.
Some Erlang struct sizes
#include "config.h"
#include "sys.h"
#include "erl_process.h"
#include "big.h"
#include "erl_binary.h"
/* Compile x86_64 after bootstrap from $(ERL_TOP)/erts/emulator with:
*
* gcc -g -O3 -fomit-frame-pointer \
* -I../x86_64-unknown-linux-gnu \
* -fno-tree-copyrename -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall \
* -Wstrict-prototypes -Wmissing-prototypes \
* -Wdeclaration-after-statement -DUSE_THREADS -D_THREAD_SAFE \
* -D_REENTRANT -DPOSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS \
* -Ix86_64-unknown-linux-gnu/opt/plain -Ibeam -Isys/unix -Isys/common \
* -Ix86_64-unknown-linux-gnu -Izlib -Ipcre -Ihipe \
* -I../include \
* -I../include/x86_64-unknown-linux-gnu \
* -I../include/internal \
* -I../include/internal/x86_64-unknown-linux-gnu beam/port_sz.c \
* -o beam/port_sz
*/
int main(int argc, char **argv)
{
printf("sizeof(Port) = %ld\n", sizeof(Port));
printf("sizeof(Process) = %ld\n", sizeof(Process));
printf("sizeof(Atom) = %ld\n", sizeof(Atom));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment