473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Enum memory allocation

Regarding use of enum's, I am wondering what the cost of memory is when creating the enumeration on the calling side, and then using it on the function/method side. See example below. If I understand correctly, what is actually happening on the calling side is an instance of the enum class FavoriteSport is getting created and sent to the PrintFavorite routine with a default value of type int. Is this correct? Say I have a couple hundred uses of this enumeration at the same time (Citrix server for a Statewide application), would I have a couple hundred or more instances of this enum class in memory

I'm still trying to understand .Net and the true object oriented nature of how it works now, so any information would be greatly appreciated

Thanks

Michael Isaac

public enum FavoriteSpor
Basebal
Socce
end enu

Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport
Select Case intFavorite ..
'if Baseball print "I Love baseball" , et
End Su

'calling pro
PrintFavorite(FavoriteSport.Soccer
Nov 20 '05 #1
6 2835
"Michael Isaacs" <an*******@discussions.microsoft.com> wrote in message news:87**********************************@microsof t.com...
Regarding use of enum's, I am wondering what the cost of memory is : an instance of the enum class FavoriteSport is getting created and sent
to the PrintFavorite routine with a default value of type int. Is this correct?
An Enum is a Structure (extending ValueType), and not a Class. Therefore,
there is no explicit creation on the heap for this memory. Instead, it is a field
within a Class, or it exists temporarily on the stack as a local variable.

The cost is typically 4 bytes. Due to 32-bit word alignment, there's usually
little benefit in assiging a smaller numeric type to the Enum (more Enums,
but they're slower to access.)
Say I have a couple hundred uses of this enumeration at the same time
(Citrix server for a Statewide application), would I have a couple hundred
or more instances of this enum class in memory?
You'll have copies of an integer (or perhaps byte, long, etc.) throughout
memory and on the stack. (Although to highlight the magnitude of this
memory consumption, observe that my PDA can hold up to 16 million
enums; hopefully the server for your app is larger than my PDA.)

: : public enum FavoriteSport
Baseball
Soccer
end enum

Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport)
4 bytes are pushed onto the stack to contain intFavorite, and the
value of this argument has its value copied to it from the calling Sub.
Select Case intFavorite ...
'if Baseball print "I Love baseball" , etc
End Sub

'calling proc
PrintFavorite(FavoriteSport.Soccer)


As this is passing a constant argument, I believe the 4 bytes are pushed
directly onto the stack of the called Sub. Contrast this to,

Dim sport As FavoriteSport = FavoriteSport.Soccer
PrintFavorite( sport)

Which has a 4-byte copy of the Enum in the calling Sub, and pushes a 4-byte
copy of the Enum to the called Sub. Hence, here memory consumption is
8-bytes.

Also observe that both Enums are stored on the stack automatically, and when
each Sub ends, the stack rolls back and the memory consumed by these Enums
are returned to the system W/O requiring a garbage collection.

Their drawback, if any, is all the copying that takes place. But, it doesn't get
any faster than copying four-bytes at a time (at least on 32-bit machines), so
this is ordinarily insignificant.
Derek Harmon
Nov 20 '05 #2
Thanks - this was very informative to me. Follow up questions ...

The question that then comes up is how VB knows that this is an enum object
if it is only stored as an integer in memory? Ie. how does it know that it
has methods, functions, etc? My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still creating
some kind of object that allows for these methods, properties, etc to be
accessed.

Also, is there any Microsoft documentation out there that explains this, or
a good web site that anyone knows about?

Thanks,

Mike

"Derek Harmon" <lo*******@msn.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
"Michael Isaacs" <an*******@discussions.microsoft.com> wrote in message news:87**********************************@microsof t.com...
Regarding use of enum's, I am wondering what the cost of memory is

:
an instance of the enum class FavoriteSport is getting created and sent
to the PrintFavorite routine with a default value of type int. Is this correct?
An Enum is a Structure (extending ValueType), and not a Class. Therefore,
there is no explicit creation on the heap for this memory. Instead, it is a field within a Class, or it exists temporarily on the stack as a local variable.

The cost is typically 4 bytes. Due to 32-bit word alignment, there's usually little benefit in assiging a smaller numeric type to the Enum (more Enums,
but they're slower to access.)
Say I have a couple hundred uses of this enumeration at the same time
(Citrix server for a Statewide application), would I have a couple
hundred or more instances of this enum class in memory?


You'll have copies of an integer (or perhaps byte, long, etc.) throughout
memory and on the stack. (Although to highlight the magnitude of this
memory consumption, observe that my PDA can hold up to 16 million
enums; hopefully the server for your app is larger than my PDA.)

: :
public enum FavoriteSport
Baseball
Soccer
end enum

Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport)


4 bytes are pushed onto the stack to contain intFavorite, and the
value of this argument has its value copied to it from the calling Sub.
Select Case intFavorite ...
'if Baseball print "I Love baseball" , etc
End Sub

'calling proc
PrintFavorite(FavoriteSport.Soccer)


As this is passing a constant argument, I believe the 4 bytes are pushed
directly onto the stack of the called Sub. Contrast this to,

Dim sport As FavoriteSport = FavoriteSport.Soccer
PrintFavorite( sport)

Which has a 4-byte copy of the Enum in the calling Sub, and pushes a

4-byte copy of the Enum to the called Sub. Hence, here memory consumption is
8-bytes.

Also observe that both Enums are stored on the stack automatically, and when each Sub ends, the stack rolls back and the memory consumed by these Enums
are returned to the system W/O requiring a garbage collection.

Their drawback, if any, is all the copying that takes place. But, it doesn't get any faster than copying four-bytes at a time (at least on 32-bit machines), so this is ordinarily insignificant.
Derek Harmon

Nov 20 '05 #3
Michael,
The question that then comes up is how VB knows that this is an enum object if it is only stored as an integer in memory? You know it is an enum object by virtual you defined it as an Enum type.
Ie. how does it know that it has methods, functions, etc? The compiler sees that it is of type FavoriteSport and knows that
FavoriteSport and acts accordingly.
My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still creating some kind of object that allows for these methods, properties, etc to be
accessed. Unfortunately this is a common misunderstanding, the compiler knows that an
Integer has certain methods and is able to call the methods directly. It
knows that an FavoriteSport has certain methods & is able to call those
directly. The only time a FavoriteSport would be "creating some kind of
object" Object in the sense that it is on the heap, is when you pass it as
an System.Object, System.Enum, System.ValueType or an Interface parameter.
Most of the time you do not/should not do this.
Also, is there any Microsoft documentation out there that explains this, or a good web site that anyone knows about? "The Common Language Infrastructure Annotated Standard" by James S. Miller,
from Addison Wesley. The Common Language Infrastructure Standard itself (non
annotated) is available on your harddisk when you install the SDK, for
VS.NET 2003 its at "\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Tool Developers Guide\docs". Primarily read up on the
difference of Reference Types & Value Types.

Hope this helps
Jay
"Michael Isaacs" <ms*******@isaacsonline.org.nomoresmp> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl... Thanks - this was very informative to me. Follow up questions ...

The question that then comes up is how VB knows that this is an enum object if it is only stored as an integer in memory? Ie. how does it know that it has methods, functions, etc? My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still creating some kind of object that allows for these methods, properties, etc to be
accessed.

Also, is there any Microsoft documentation out there that explains this, or a good web site that anyone knows about?

Thanks,

Mike

"Derek Harmon" <lo*******@msn.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
"Michael Isaacs" <an*******@discussions.microsoft.com> wrote in message news:87**********************************@microsof t.com...
Regarding use of enum's, I am wondering what the cost of memory is

:
an instance of the enum class FavoriteSport is getting created and sent to the PrintFavorite routine with a default value of type int. Is
this correct?

An Enum is a Structure (extending ValueType), and not a Class. Therefore, there is no explicit creation on the heap for this memory. Instead, it is
a field
within a Class, or it exists temporarily on the stack as a local

variable.
The cost is typically 4 bytes. Due to 32-bit word alignment, there's

usually
little benefit in assiging a smaller numeric type to the Enum (more Enums, but they're slower to access.)
Say I have a couple hundred uses of this enumeration at the same time
(Citrix server for a Statewide application), would I have a couple hundred or more instances of this enum class in memory?


You'll have copies of an integer (or perhaps byte, long, etc.)

throughout memory and on the stack. (Although to highlight the magnitude of this
memory consumption, observe that my PDA can hold up to 16 million
enums; hopefully the server for your app is larger than my PDA.)

: :
public enum FavoriteSport
Baseball
Soccer
end enum

Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport)


4 bytes are pushed onto the stack to contain intFavorite, and the
value of this argument has its value copied to it from the calling Sub.
Select Case intFavorite ...
'if Baseball print "I Love baseball" , etc
End Sub

'calling proc
PrintFavorite(FavoriteSport.Soccer)


As this is passing a constant argument, I believe the 4 bytes are pushed
directly onto the stack of the called Sub. Contrast this to,

Dim sport As FavoriteSport = FavoriteSport.Soccer
PrintFavorite( sport)

Which has a 4-byte copy of the Enum in the calling Sub, and pushes a

4-byte
copy of the Enum to the called Sub. Hence, here memory consumption is
8-bytes.

Also observe that both Enums are stored on the stack automatically, and

when
each Sub ends, the stack rolls back and the memory consumed by these Enums are returned to the system W/O requiring a garbage collection.

Their drawback, if any, is all the copying that takes place. But, it

doesn't get
any faster than copying four-bytes at a time (at least on 32-bit

machines), so
this is ordinarily insignificant.
Derek Harmon


Nov 20 '05 #4
Michael,
The question that then comes up is how VB knows that this is an enum object if it is only stored as an integer in memory? You know it is an enum object by virtual you defined it as an Enum type.
Ie. how does it know that it has methods, functions, etc? The compiler sees that it is of type FavoriteSport and knows that
FavoriteSport and acts accordingly.
My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still creating some kind of object that allows for these methods, properties, etc to be
accessed. Unfortunately this is a common misunderstanding, the compiler knows that an
Integer has certain methods and is able to call the methods directly. It
knows that an FavoriteSport has certain methods & is able to call those
directly. The only time a FavoriteSport would be "creating some kind of
object" Object in the sense that it is on the heap, is when you pass it as
an System.Object, System.Enum, System.ValueType or an Interface parameter.
Most of the time you do not/should not do this.
Also, is there any Microsoft documentation out there that explains this, or a good web site that anyone knows about? "The Common Language Infrastructure Annotated Standard" by James S. Miller,
from Addison Wesley. The Common Language Infrastructure Standard itself (non
annotated) is available on your harddisk when you install the SDK, for
VS.NET 2003 its at "\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Tool Developers Guide\docs". Primarily read up on the
difference of Reference Types & Value Types.

Hope this helps
Jay
"Michael Isaacs" <ms*******@isaacsonline.org.nomoresmp> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl... Thanks - this was very informative to me. Follow up questions ...

The question that then comes up is how VB knows that this is an enum object if it is only stored as an integer in memory? Ie. how does it know that it has methods, functions, etc? My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still creating some kind of object that allows for these methods, properties, etc to be
accessed.

Also, is there any Microsoft documentation out there that explains this, or a good web site that anyone knows about?

Thanks,

Mike

"Derek Harmon" <lo*******@msn.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
"Michael Isaacs" <an*******@discussions.microsoft.com> wrote in message news:87**********************************@microsof t.com...
Regarding use of enum's, I am wondering what the cost of memory is

:
an instance of the enum class FavoriteSport is getting created and sent to the PrintFavorite routine with a default value of type int. Is
this correct?

An Enum is a Structure (extending ValueType), and not a Class. Therefore, there is no explicit creation on the heap for this memory. Instead, it is
a field
within a Class, or it exists temporarily on the stack as a local

variable.
The cost is typically 4 bytes. Due to 32-bit word alignment, there's

usually
little benefit in assiging a smaller numeric type to the Enum (more Enums, but they're slower to access.)
Say I have a couple hundred uses of this enumeration at the same time
(Citrix server for a Statewide application), would I have a couple hundred or more instances of this enum class in memory?


You'll have copies of an integer (or perhaps byte, long, etc.)

throughout memory and on the stack. (Although to highlight the magnitude of this
memory consumption, observe that my PDA can hold up to 16 million
enums; hopefully the server for your app is larger than my PDA.)

: :
public enum FavoriteSport
Baseball
Soccer
end enum

Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport)


4 bytes are pushed onto the stack to contain intFavorite, and the
value of this argument has its value copied to it from the calling Sub.
Select Case intFavorite ...
'if Baseball print "I Love baseball" , etc
End Sub

'calling proc
PrintFavorite(FavoriteSport.Soccer)


As this is passing a constant argument, I believe the 4 bytes are pushed
directly onto the stack of the called Sub. Contrast this to,

Dim sport As FavoriteSport = FavoriteSport.Soccer
PrintFavorite( sport)

Which has a 4-byte copy of the Enum in the calling Sub, and pushes a

4-byte
copy of the Enum to the called Sub. Hence, here memory consumption is
8-bytes.

Also observe that both Enums are stored on the stack automatically, and

when
each Sub ends, the stack rolls back and the memory consumed by these Enums are returned to the system W/O requiring a garbage collection.

Their drawback, if any, is all the copying that takes place. But, it

doesn't get
any faster than copying four-bytes at a time (at least on 32-bit

machines), so
this is ordinarily insignificant.
Derek Harmon


Nov 20 '05 #5
Thanks Jay.

I also did a test using enum objects and checking memory usage to confirm
that enum objects only take the amount of memory of the base type (default
integer = 4 bytes). This satisfied my manager on the subject. Also, good
point about integers and the comparison between integer variables and
enums - both do have methods, etc, but are both stored as 4 bytes when used.

Michael Isaacs
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ux**************@TK2MSFTNGP11.phx.gbl...
Michael,
The question that then comes up is how VB knows that this is an enum object
if it is only stored as an integer in memory?

You know it is an enum object by virtual you defined it as an Enum type.
Ie. how does it know that it has methods, functions, etc?

The compiler sees that it is of type FavoriteSport and knows that
FavoriteSport and acts accordingly.
My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still

creating
some kind of object that allows for these methods, properties, etc to be
accessed.

Unfortunately this is a common misunderstanding, the compiler knows that

an Integer has certain methods and is able to call the methods directly. It
knows that an FavoriteSport has certain methods & is able to call those
directly. The only time a FavoriteSport would be "creating some kind of
object" Object in the sense that it is on the heap, is when you pass it as
an System.Object, System.Enum, System.ValueType or an Interface parameter.
Most of the time you do not/should not do this.
Also, is there any Microsoft documentation out there that explains this, or
a good web site that anyone knows about?

"The Common Language Infrastructure Annotated Standard" by James S.

Miller, from Addison Wesley. The Common Language Infrastructure Standard itself (non annotated) is available on your harddisk when you install the SDK, for
VS.NET 2003 its at "\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Tool Developers Guide\docs". Primarily read up on the
difference of Reference Types & Value Types.

Hope this helps
Jay
"Michael Isaacs" <ms*******@isaacsonline.org.nomoresmp> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Thanks - this was very informative to me. Follow up questions ...

The question that then comes up is how VB knows that this is an enum object
if it is only stored as an integer in memory? Ie. how does it know that

it
has methods, functions, etc? My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still

creating
some kind of object that allows for these methods, properties, etc to be
accessed.

Also, is there any Microsoft documentation out there that explains this,

or
a good web site that anyone knows about?

Thanks,

Mike

"Derek Harmon" <lo*******@msn.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
"Michael Isaacs" <an*******@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.com...
> Regarding use of enum's, I am wondering what the cost of memory is
:
> an instance of the enum class FavoriteSport is getting created and sent > to the PrintFavorite routine with a default value of type int. Is this
correct?

An Enum is a Structure (extending ValueType), and not a Class.

Therefore, there is no explicit creation on the heap for this memory. Instead,
it is
a field
within a Class, or it exists temporarily on the stack as a local

variable.
The cost is typically 4 bytes. Due to 32-bit word alignment, there's

usually
little benefit in assiging a smaller numeric type to the Enum (more Enums, but they're slower to access.)

> Say I have a couple hundred uses of this enumeration at the same
time > (Citrix server for a Statewide application), would I have a couple

hundred
> or more instances of this enum class in memory?

You'll have copies of an integer (or perhaps byte, long, etc.)

throughout memory and on the stack. (Although to highlight the magnitude of this
memory consumption, observe that my PDA can hold up to 16 million
enums; hopefully the server for your app is larger than my PDA.)

: :
> public enum FavoriteSport
> Baseball
> Soccer
> end enum
>
> Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport)

4 bytes are pushed onto the stack to contain intFavorite, and the
value of this argument has its value copied to it from the calling Sub.
> Select Case intFavorite ...
> 'if Baseball print "I Love baseball" , etc
> End Sub
>
> 'calling proc
> PrintFavorite(FavoriteSport.Soccer)

As this is passing a constant argument, I believe the 4 bytes are pushed directly onto the stack of the called Sub. Contrast this to,

Dim sport As FavoriteSport = FavoriteSport.Soccer
PrintFavorite( sport)

Which has a 4-byte copy of the Enum in the calling Sub, and pushes a

4-byte
copy of the Enum to the called Sub. Hence, here memory consumption is
8-bytes.

Also observe that both Enums are stored on the stack automatically,
and when
each Sub ends, the stack rolls back and the memory consumed by these

Enums are returned to the system W/O requiring a garbage collection.

Their drawback, if any, is all the copying that takes place. But, it

doesn't get
any faster than copying four-bytes at a time (at least on 32-bit

machines), so
this is ordinarily insignificant.
Derek Harmon



Nov 20 '05 #6
Thanks Jay.

I also did a test using enum objects and checking memory usage to confirm
that enum objects only take the amount of memory of the base type (default
integer = 4 bytes). This satisfied my manager on the subject. Also, good
point about integers and the comparison between integer variables and
enums - both do have methods, etc, but are both stored as 4 bytes when used.

Michael Isaacs
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ux**************@TK2MSFTNGP11.phx.gbl...
Michael,
The question that then comes up is how VB knows that this is an enum object
if it is only stored as an integer in memory?

You know it is an enum object by virtual you defined it as an Enum type.
Ie. how does it know that it has methods, functions, etc?

The compiler sees that it is of type FavoriteSport and knows that
FavoriteSport and acts accordingly.
My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still

creating
some kind of object that allows for these methods, properties, etc to be
accessed.

Unfortunately this is a common misunderstanding, the compiler knows that

an Integer has certain methods and is able to call the methods directly. It
knows that an FavoriteSport has certain methods & is able to call those
directly. The only time a FavoriteSport would be "creating some kind of
object" Object in the sense that it is on the heap, is when you pass it as
an System.Object, System.Enum, System.ValueType or an Interface parameter.
Most of the time you do not/should not do this.
Also, is there any Microsoft documentation out there that explains this, or
a good web site that anyone knows about?

"The Common Language Infrastructure Annotated Standard" by James S.

Miller, from Addison Wesley. The Common Language Infrastructure Standard itself (non annotated) is available on your harddisk when you install the SDK, for
VS.NET 2003 its at "\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Tool Developers Guide\docs". Primarily read up on the
difference of Reference Types & Value Types.

Hope this helps
Jay
"Michael Isaacs" <ms*******@isaacsonline.org.nomoresmp> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Thanks - this was very informative to me. Follow up questions ...

The question that then comes up is how VB knows that this is an enum object
if it is only stored as an integer in memory? Ie. how does it know that

it
has methods, functions, etc? My manager is concerned that even if only 4
bytes are being sent in to the function, that the function is still

creating
some kind of object that allows for these methods, properties, etc to be
accessed.

Also, is there any Microsoft documentation out there that explains this,

or
a good web site that anyone knows about?

Thanks,

Mike

"Derek Harmon" <lo*******@msn.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
"Michael Isaacs" <an*******@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.com...
> Regarding use of enum's, I am wondering what the cost of memory is
:
> an instance of the enum class FavoriteSport is getting created and sent > to the PrintFavorite routine with a default value of type int. Is this
correct?

An Enum is a Structure (extending ValueType), and not a Class.

Therefore, there is no explicit creation on the heap for this memory. Instead,
it is
a field
within a Class, or it exists temporarily on the stack as a local

variable.
The cost is typically 4 bytes. Due to 32-bit word alignment, there's

usually
little benefit in assiging a smaller numeric type to the Enum (more Enums, but they're slower to access.)

> Say I have a couple hundred uses of this enumeration at the same
time > (Citrix server for a Statewide application), would I have a couple

hundred
> or more instances of this enum class in memory?

You'll have copies of an integer (or perhaps byte, long, etc.)

throughout memory and on the stack. (Although to highlight the magnitude of this
memory consumption, observe that my PDA can hold up to 16 million
enums; hopefully the server for your app is larger than my PDA.)

: :
> public enum FavoriteSport
> Baseball
> Soccer
> end enum
>
> Public Sub PrintFavorite(ByVal intFavorite as FavoriteSport)

4 bytes are pushed onto the stack to contain intFavorite, and the
value of this argument has its value copied to it from the calling Sub.
> Select Case intFavorite ...
> 'if Baseball print "I Love baseball" , etc
> End Sub
>
> 'calling proc
> PrintFavorite(FavoriteSport.Soccer)

As this is passing a constant argument, I believe the 4 bytes are pushed directly onto the stack of the called Sub. Contrast this to,

Dim sport As FavoriteSport = FavoriteSport.Soccer
PrintFavorite( sport)

Which has a 4-byte copy of the Enum in the calling Sub, and pushes a

4-byte
copy of the Enum to the called Sub. Hence, here memory consumption is
8-bytes.

Also observe that both Enums are stored on the stack automatically,
and when
each Sub ends, the stack rolls back and the memory consumed by these

Enums are returned to the system W/O requiring a garbage collection.

Their drawback, if any, is all the copying that takes place. But, it

doesn't get
any faster than copying four-bytes at a time (at least on 32-bit

machines), so
this is ordinarily insignificant.
Derek Harmon



Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: chris | last post by:
Hi all, I need to know, what is the difference between dynamic memory allocation, and stack allocation ? 1. If I have a class named DestinationAddress, when should I use dynamic memory...
5
by: Michael Isaacs | last post by:
Regarding use of enum's, I am wondering what the cost of memory is when creating the enumeration on the calling side, and then using it on the function/method side. See example below. If I...
62
by: ivan.leben | last post by:
How can I really delete a preloaded image from memory/disk cache? Let's say I preload an image by creating an Image object and setting its src attribute to desired URL: var img = new Image();...
66
by: Johan Tibell | last post by:
I've written a piece of code that uses sockets a lot (I know that sockets aren't portable C, this is not a question about sockets per se). Much of my code ended up looking like this: if...
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
24
by: Ken | last post by:
In C programming, I want to know in what situations we should use static memory allocation instead of dynamic memory allocation. My understanding is that static memory allocation like using array...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
10
by: Charlie | last post by:
I tried to post this before and I apologize if I am repeating myself, but I do not see the post anywhere. But anyway, I have a file, data.c, where I define all of my global variables. I then...
66
by: karthikbalaguru | last post by:
Hi, Will 'free' return the memory Immediately to the OS ? Thx in advans, Karthik Balaguru
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.