C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problème d'allocation

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
fanny & michou
Guest





PostPosted: Fri Sep 10, 2004 9:37 pm    Post subject: Problème d'allocation Reply with quote



Bonjour,

Je programme a deux endroits différents (voir post : "Problème avec
abs") et bienqu'a mon travail mon programme s'exécute correctement, je
suis confrontée à une erreur chez moi :
une fois le programme lancé, j'ai le message d'erreur
" terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
Aborted"

Quelqu'un a-t-il une piste pour m'aider a resoudre ce problème?
C'est pas très agréable de programmer via une connexion ssh pas toujours
très rapide ;-)

Merci pour votre aide.
Fanny
Back to top
Jonathan Mcdougall
Guest





PostPosted: Sat Sep 11, 2004 7:49 am    Post subject: Re: Problème d'allocation Reply with quote



Quote:
une fois le programme lancé, j'ai le message d'erreur
" terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
Aborted"

Quelqu'un a-t-il une piste pour m'aider a resoudre ce problème?

std::bad_alloc est lancé par new lorsqu'il n'y a plus de mémoire
disponible :

# include <iostream>


int main()
{
try
{

while (true)
{
int *i = new int[10000];
}

}
catch(std::bad_alloc&)
{
std::cout << "et voila" << std::endl;
}
}

Quelles genres d'opérations fais-tu avec new?


Jonathan

Back to top
Pierre Maurette
Guest





PostPosted: Sat Sep 11, 2004 8:04 am    Post subject: Re: Problème d'allocation Reply with quote



fanny & michou <fanny.michou (AT) free (DOT) fr> a écrit:

Quote:
Bonjour,
Bonjour,

Problème d'allocation ?
http://www.caf.fr/
Bon week-end
--
Pierre

Back to top
fanny & michou
Guest





PostPosted: Sat Sep 11, 2004 12:47 pm    Post subject: Re: Problème d'allocation Reply with quote


Quote:
# include <iostream


int main()
{
try
{

while (true)
{
int *i = new int[10000];
}

}
catch(std::bad_alloc&)
{
std::cout << "et voila" << std::endl;
}
}

Quelles genres d'opérations fais-tu avec new?


Jonathan

Ben je créé un nouvel objet : il bloque au moment de
créer une matrice je crois donc vector< vector .
Mais je comprends pas : ca marche a mon travail parce
qu'il y a plus de mémoire?

Back to top
Jonathan Mcdougall
Guest





PostPosted: Sun Sep 12, 2004 7:05 am    Post subject: Re: Problème d'allocation Reply with quote

fanny & michou wrote:
Quote:

# include <iostream


int main()
{
try
{

while (true)
{
int *i = new int[10000];
}

}
catch(std::bad_alloc&)
{
std::cout << "et voila" << std::endl;
}
}

Quelles genres d'opérations fais-tu avec new?


Ben je créé un nouvel objet : il bloque au moment de
créer une matrice je crois donc vector< vector .

Peux-tu montrer un peu de code? Comme std::vector utilise
habituellement new et delete, il est possible qu'il manque de mémoire à
l'interne.

Quote:
Mais je comprends pas : ca marche a mon travail parce
qu'il y a plus de mémoire?

std::bad_alloc ne peut être lancé que parce que new n'a pas fonctionné.
Comme habituellement, new utilise malloc et que malloc utilise la
mémoire vive du système, une des conclusions possibles est que tu
manques de mémoire vive chez toi, mais que ça marche à ton travail.
Est-ce possible?

Jonathan

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.