Discussion:
[Gc] Alignment/padding of small objects on 64-bit platform (x86-64)
Stefan Kral
2014-10-11 14:58:40 UTC
Permalink
Hello.

My app operates on a lot of 3-word objects and I wonder if it would be
reasonable to adapt the granule size accordingly.

The application requires 64-bit pointers and has no double-word alignment
requirements, so I would be keen on reducing the memory requirement.

I'm grateful for any advise and/or tips!

Best Regards,
Stefan.
Bruce Hoult
2014-10-11 21:31:21 UTC
Permalink
The GC needs to store a pointer for a free list, so needs at least 8 bytes
per object. And aligned on most CPUs.
Post by Stefan Kral
Hello.
My app operates on a lot of 3-word objects and I wonder if it would be
reasonable to adapt the granule size accordingly.
The application requires 64-bit pointers and has no double-word alignment
requirements, so I would be keen on reducing the memory requirement.
I'm grateful for any advise and/or tips!
Best Regards,
Stefan.
--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.
Stefan Kral
2014-10-11 21:39:26 UTC
Permalink
That is okay with me... At the moment the GC allocates memory in chunks of
16 bytes, so I lose 8 bytes everytime I allocate a 24 byte block.

Would lowering the granule size to 8 bytes likely cause any problems? (If
most of my allocations are small...)

Regards, Stefan.
Post by Bruce Hoult
The GC needs to store a pointer for a free list, so needs at least 8 bytes
per object. And aligned on most CPUs.
Post by Stefan Kral
Hello.
My app operates on a lot of 3-word objects and I wonder if it would be
reasonable to adapt the granule size accordingly.
The application requires 64-bit pointers and has no double-word alignment
requirements, so I would be keen on reducing the memory requirement.
I'm grateful for any advise and/or tips!
Best Regards,
Stefan.
--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.
Bruce Hoult
2014-10-11 22:13:41 UTC
Permalink
It would be a definite bug if it didn't work with 8 bytes. Some support
data structures might use a bit more space.
Post by Stefan Kral
That is okay with me... At the moment the GC allocates memory in chunks of
16 bytes, so I lose 8 bytes everytime I allocate a 24 byte block.
Would lowering the granule size to 8 bytes likely cause any problems? (If
most of my allocations are small...)
Regards, Stefan.
Post by Bruce Hoult
The GC needs to store a pointer for a free list, so needs at least 8
bytes per object. And aligned on most CPUs.
Post by Stefan Kral
Hello.
My app operates on a lot of 3-word objects and I wonder if it would be
reasonable to adapt the granule size accordingly.
The application requires 64-bit pointers and has no double-word
alignment requirements, so I would be keen on reducing the memory
requirement.
I'm grateful for any advise and/or tips!
Best Regards,
Stefan.
--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.
--
This message has been scanned for viruses and
dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
believed to be clean.
Loading...