FAQ
Is there any cap on Go's built-in map or slice? I know slice can have cap
but what is the maximum number of elements that we can have in one map and
slice?

I am thinking about having my entries in Redis or other key-value storage
until I have too many entries to store in memory.

Any advice will be appreciated. Thanks!

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Caleb Spare at Feb 8, 2015 at 4:20 am
    The length and capacity of slices and maps are ints, so I believe that
    the int size on your platform (as well as available memory, of course)
    are the only limitations.
    On Sat, Feb 7, 2015 at 8:17 PM, Gyu-Ho Lee wrote:
    Is there any cap on Go's built-in map or slice? I know slice can have cap
    but what is the maximum number of elements that we can have in one map and
    slice?

    I am thinking about having my entries in Redis or other key-value storage
    until I have too many entries to store in memory.

    Any advice will be appreciated. Thanks!

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
  • Caleb Spare at Feb 8, 2015 at 4:20 am
    (not that maps have a cap)
    On Sat, Feb 7, 2015 at 8:19 PM, Caleb Spare wrote:
    The length and capacity of slices and maps are ints, so I believe that
    the int size on your platform (as well as available memory, of course)
    are the only limitations.
    On Sat, Feb 7, 2015 at 8:17 PM, Gyu-Ho Lee wrote:
    Is there any cap on Go's built-in map or slice? I know slice can have cap
    but what is the maximum number of elements that we can have in one map and
    slice?

    I am thinking about having my entries in Redis or other key-value storage
    until I have too many entries to store in memory.

    Any advice will be appreciated. Thanks!

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
  • Gyu-Ho Lee at Feb 8, 2015 at 4:22 am
    I see. Thanks! I learned it today.

    https://golang.org/ref/spec#Numeric_types
    On Sat Feb 07 2015 at 8:20:34 PM Caleb Spare wrote:

    (not that maps have a cap)
    On Sat, Feb 7, 2015 at 8:19 PM, Caleb Spare wrote:
    The length and capacity of slices and maps are ints, so I believe that
    the int size on your platform (as well as available memory, of course)
    are the only limitations.
    On Sat, Feb 7, 2015 at 8:17 PM, Gyu-Ho Lee wrote:
    Is there any cap on Go's built-in map or slice? I know slice can have
    cap
    but what is the maximum number of elements that we can have in one map
    and
    slice?

    I am thinking about having my entries in Redis or other key-value
    storage
    until I have too many entries to store in memory.

    Any advice will be appreciated. Thanks!

    --
    You received this message because you are subscribed to the Google
    Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
  • Harmen B at Feb 8, 2015 at 2:29 pm
    Be careful with the garbage collector, though. If you keep millions of
    elements around the garbage collector might give you longer pauses than you
    would like (but this behavior is likely to change in next Go versions, for
    the better).
    On Sun, Feb 8, 2015 at 5:22 AM, Gyu-Ho Lee wrote:

    I see. Thanks! I learned it today.

    https://golang.org/ref/spec#Numeric_types
    On Sat Feb 07 2015 at 8:20:34 PM Caleb Spare wrote:

    (not that maps have a cap)
    On Sat, Feb 7, 2015 at 8:19 PM, Caleb Spare wrote:
    The length and capacity of slices and maps are ints, so I believe that
    the int size on your platform (as well as available memory, of course)
    are the only limitations.
    On Sat, Feb 7, 2015 at 8:17 PM, Gyu-Ho Lee wrote:
    Is there any cap on Go's built-in map or slice? I know slice can have
    cap
    but what is the maximum number of elements that we can have in one map
    and
    slice?

    I am thinking about having my entries in Redis or other key-value
    storage
    until I have too many entries to store in memory.

    Any advice will be appreciated. Thanks!

    --
    You received this message because you are subscribed to the Google
    Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
  • Dave Cheney at Feb 8, 2015 at 11:41 pm
    There is no limit the number of elements you can store in a map save the limitations of your hardware or the current maximum size of the heap.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/d/optout.
  • Gyu-Ho Lee at Feb 9, 2015 at 12:45 am
    I see. Yeah I see that after storing over 2 million, my program pauses a
    bit long.

    Thanks, Dave and Harmen.
    On Sunday, February 8, 2015 at 3:41:41 PM UTC-8, Dave Cheney wrote:

    There is no limit the number of elements you can store in a map save the
    limitations of your hardware or the current maximum size of the heap.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 8, '15 at 4:18a
activeFeb 9, '15 at 12:45a
posts7
users4
websitegolang.org

People

Translate

site design / logo © 2023 Grokbase